Magento: Get Base and Current Currency and Convert Prices

Magento: Get Base and Current Currency and Convert Prices

Magento currency conversion in code: fetch the base and current currency codes and convert prices between them with the directory helper.

Magento update currency rates from base currency to current currency

Magento: here is code to fetch current currency code and to get default(base) currency code in magento

<?php 

Mage::app()->getStore()->getDefaultCurrencyCode();

Mage::app()->getStore()->getCurrentCurrencyCode();
?>

Update price based from base currency to current currency in magento

<?php

$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode(); 
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode(); 

$price = Mage::helper('directory')->currencyConvert($pricetoconvert, $baseCurrencyCode, $currentCurrencyCode); 

?>

Still on Magento 1? This tutorial is for Magento 1.x, which reached end of life in June 2020 and no longer receives security patches. Our team migrates Magento 1 stores to Magento 2, Mage-OS or Adobe Commerce with your SEO and data intact — see our Magento development services.

Further reading: OpenMage, the community-maintained Magento 1 fork. Need a hand? Our Magento development team can help.

Need a hand?

Stuck on a build?
Let's solve it together.

Our engineers fix, upgrade and scale Magento, WordPress and modern stacks every day.