Home » Magento, Magento 228 April 2016

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

This 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.

Using Dependency Injection (DI)

Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface & 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.

Using Object Manager

Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Girish Patel

    Hi Mukesh,

    Thanks for this post.

    However i can not see code for convert currentcurrency to basecurrency. So how can i set that. Please help