Log in
Model

Currency

Magento\Directory\Model\Currency

What it does

This class manages currency operations in Magento 2, including currency code retrieval, conversion between currencies using exchange rates, and formatting prices according to locale and currency rules.

Developers use this class when they need to convert amounts between different currencies, format prices for display with proper symbols and formatting, or retrieve configured currency settings from the admin panel.

Public Methods

  • getCode()
  • getCurrencyCode()
  • getRates()
  • setRates()
  • load()
  • getRate()
  • getAnyRate()
  • convert()
  • getFilter()
  • format()
  • formatPrecision()
  • formatTxt()
  • getCurrencySymbol()
  • getOutputFormat()
  • getConfigAllowCurrencies()
  • getConfigDefaultCurrencies()
  • getConfigBaseCurrencies()
  • getCurrencyRates()
  • saveRates()
  • _resetState()