Magento 2: Get Currency Code, Currency Symbol & Currency Rate

Magento 2: Get Currency Code, Currency Symbol & Currency Rate

Tis article shows how we can get our store’s currency code, currency symbol, and currency rate in Magento 2. We will be fetching all base, default and current currency code. We will also be fetching available currency codes and allowed currency codes.

Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object ofStoreManagerInterface & Currency in the constructor of my module’s block class.

app/code/Chapagain/HelloWorld/Block/HelloWorld.php

See more functions in vendor/magento/module-store/Model/Store.php and vendor/magento/module-directory/Model/Currency.php.

Now, we print the currency rate, currency code, and currency symbol in our template (.phtml) file.

Leave a Comment