🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Convert Price From Current Currency to Base Currency in Magento 2

By Sanjay JethvaUpdated on May 22, 2025 1 min read

Magento 2 Base Currency:

  • The default currency set up in the backend.
  • The admin uses it to set the product price in the backend.
  • It can be set at global/website scope.
  • It is applied for all store and store views.

Magento 2 Current Currency:

  • It is used to display the price in the frontend.
  • It is independent of the base currency.
  • It can be set for each store view.

Given the difference between both the terms, let’s proceed with the method to convert price from current currency to base currency in Magento 2.

The store set up with multi-currencies might need this solution while the development process, in order to experiment with the features that require particular conditions for base currency!

Also Read, How to Auto Update Currency Rates in Magento 2

Solution to Convert Price From Current Currency to Base Currency in Magento 2:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 
 $priceCurrencyFactory = $objectManager->get('Magento\Directory\Model\CurrencyFactory');
 $storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface');
 
 $currencyCodeTo = $storeManager->getStore()->getCurrentCurrency()->getCode();
 $currencyCodeFrom = $storeManager->getStore()->getBaseCurrency()->getCode();
 
 $itemAmount = 100; // product price
 $rate = $priceCurrencyFactory->create()->load($currencyCodeTo)->getAnyRate($currencyCodeFrom);
 $itemAmount = $itemAmount * $rate;

That’s it! 

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.