{"id":377,"date":"2019-04-15T13:30:34","date_gmt":"2019-04-15T13:30:34","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/04\/15\/convert-price-from-current-currency-to-base-currency-in-magento-2\/"},"modified":"2025-07-23T10:13:47","modified_gmt":"2025-07-23T04:43:47","slug":"convert-price-from-current-currency-to-base-currency-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/convert-price-from-current-currency-to-base-currency-in-magento-2\/","title":{"rendered":"How to Convert Price From Current Currency to Base Currency in Magento 2"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Magento 2 Base Currency:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The default currency set up in the backend.<\/li>\n\n\n\n<li>The admin uses it to set the product price in the backend.<\/li>\n\n\n\n<li>It can be set at global\/website scope.<\/li>\n\n\n\n<li>It is applied for all store and store views.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Magento 2 Current Currency:<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It is used to display the price in the frontend.<\/li>\n\n\n\n<li>It is independent of the base currency.<\/li>\n\n\n\n<li>It can be set for each store view.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Given the difference between both the terms, let&#8217;s proceed with the method to <strong>convert price from current currency to base currency in Magento 2<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also Read, <a title=\"How to Auto Update Currency Rates in Magento 2\" href=\"https:\/\/meetanshi.com\/blog\/auto-update-currency-rates-in-magento-2\/\">How to Auto Update Currency Rates in Magento 2<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution to Convert Price From Current Currency to Base Currency in Magento 2:<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$objectManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n \n $priceCurrencyFactory = $objectManager->get('Magento\\Directory\\Model\\CurrencyFactory');\n $storeManager = $objectManager->get('Magento\\Store\\Model\\StoreManagerInterface');\n \n $currencyCodeTo = $storeManager->getStore()->getCurrentCurrency()->getCode();\n $currencyCodeFrom = $storeManager->getStore()->getBaseCurrency()->getCode();\n \n $itemAmount = 100; \/\/ product price\n $rate = $priceCurrencyFactory->create()->load($currencyCodeTo)->getAnyRate($currencyCodeFrom);\n $itemAmount = $itemAmount * $rate;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it!&nbsp; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 Base Currency: Magento 2 Current Currency: Given the difference between both the terms, let&#8217;s proceed with the method to convert price from current&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-377","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=377"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":19125,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/377\/revisions\/19125"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}