38 votes
Accepted

Magento 2: get the current currency code

In a block In Magento 2, you can use the \Magento\Store\Model\StoreManagerInterface which is stored in an accessible variable $_storeManager for every class extending \Magento\Framework\View\Element\...
Raphael at Digital Pianism's user avatar
20 votes
Accepted

Magento 2: How to get current Currency and symbol in PHTML File?

please note that creating this with objectManager, not the best practice $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $objectManager->get('Magento\Store\...
Mostafa Sakr's user avatar
18 votes
Accepted

How to change currency format in Magento 2?

create just simple module and overrider default *Format.php** file, app/code/Package/Modulename/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
Rakesh Jesadiya's user avatar
14 votes

Magento 2: How to get current Currency and symbol in PHTML File?

Another way to approach this would be to use the Pricing\Helper, this will both give you the currency symbol and format the number to the correct decimal place. $objectManager = \Magento\Framework\...
Holly's user avatar
  • 4,873
12 votes
Accepted

How To Change Base currency for a multi store site

I will paraphrase the answer of St0iK. You can't set different base currency per store, but you can do it per website. First you have to go to the admin panel -> System -> Configuration -> CATALOG -> ...
michael's user avatar
  • 2,770
11 votes
Accepted

Free currency converter fixer.io stopped working

The Free Currency Converter API module: app/code/MyCompany/FreeCurrencyConverter/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
krybbio's user avatar
  • 1,258
10 votes
Accepted

Magento2 - admin price input's are rounding value to 2 decimals

You may try the step below for this customization: I assume you are using a custom module name "Company_MyModle" step 1) Create a di.xml file under MAGETNTO-ROOT/app/code/Company/Company_MyModle/...
Pritam Biswas's user avatar
9 votes

Magento 2: How to get current Currency and symbol in PHTML File?

create helper file with method: I believe it's right practice use Magento\Store\Model\StoreManagerInterface; use Magento\Directory\Model\CurrencyFactory; class Data { /** * @var ...
Pramod Kharade's user avatar
8 votes

How to use paypal for other currency in Magento2

Here is the example of use AED currency in PayPal. You can use same for other currencies. Follow this step to support other currencies in paypal: 1) Override Config.php and Nvp.php app/code/{...
Prince Patel's user avatar
  • 22.7k
7 votes

Magento 2: get the current currency code

This takes inspiration from Magento\Framework\Pricing\Render\Amount and it's working good in my case (behaving like Magento): protected $_priceCurrency; public function __construct( ... \Magento\...
Andrea's user avatar
  • 1,849
7 votes

Magento 2 Get Currency Symbol from Currency Code

We can do this using Constructor injection. /** * @var \Magento\Framework\Locale\CurrencyInterface */ protected $_localeCurrency public function __construct( \Magento\Framework\Locale\...
Ronak Parmar's user avatar
7 votes

How to add Space between Currency Symbol and Price in Magento 2?

Just do like above screenshot in Magento 2 admin and space will be shown in frontend.
Shyam Krishna Sreekumar's user avatar
7 votes

Magento 2.4.3 currency symbol not showing on product,cart and checkout page

Its a bug in 2.4.3: src\vendor\magento\module-directory\Model\Currency.php Comment out these lines: if ($this->canUseNumberFormatter($options)) { return $this->formatCurrency($price, $...
Kalvin Klien's user avatar
6 votes

Magento 2: How to get current Currency and symbol in PHTML File?

<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterfa‌​ce'); $currencyCode = $storeManager-&...
Ankit Sharma's user avatar
6 votes
Accepted

Magento 2 - Get currency of an order item

You can try: $order = $this->orderRepository->get($orderId); $order->getOrderCurrencyCode(); //$order->getBaseCurrencyCode(); //$order->getGlobalCurrencyCode(); Look at sales_order ...
Khoa TruongDinh's user avatar
6 votes

convert amount form one currency to another currency in magento 2

You can use this code (or whole class) to convert from the one currency to another: <?php /** * Created by PhpStorm. * User: siarhey * Date: 8/26/17 * Time: 7:25 AM */ class ...
Siarhey Uchukhlebau's user avatar
6 votes

Magento 2 : How do conver price from any currency to base currency?

NOTE: In the example the amount in current store currency is converting to amount in base store currency. You can use this code to convert one currency to another: /** * @var \Magento\Store\Model\...
Siarhey Uchukhlebau's user avatar
6 votes
Accepted

Magento 2 How to change currency symbol position left to right

You can do it by writing single event observer Create registration file: Vendor\Module\registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\...
Nikunj Vadariya's user avatar
5 votes

How to change currency format in Magento 2?

By default of Magento 2, price format is a little strange for some currencies so we need to change it. Here’s the way to change price format. Here’s the example for the case of Vietnamese dong. ...
Aasim Goriya's user avatar
  • 5,444
5 votes

How to change currency format in Magento 2?

Use below code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $objectManager->create('\Magento\Framework\Pricing\PriceCurrencyInterface')->format('999,00',true,0); ...
Prashant Valanda's user avatar
5 votes
Accepted

Show custom currency symbol in Magento2

You need add "symbol" in $currencyOptions array. Please add this below code in your observer file : <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license ...
Rohan Hapani's user avatar
  • 17.4k
4 votes
Accepted

Magento 2 Get Currency Symbol from Currency Code

It should be: $currency = $_objectManager->create('Magento\Directory\Model\CurrencyFactory')->create()->load($currencyCode); $currencySymbol = $currency->getCurrencySymbol(); It would be ...
Bartłomiej Szubert's user avatar
4 votes

How To Change Base currency for a multi store site

It turns out that Base Currency can be set on each Store View. However, this option was not presented on the admin side. I had to change the system.xml app/code/core/Mage/Directory/etc/system.xml &...
Sankar_k's user avatar
  • 614
4 votes
Accepted

Arabic Currency Name to be move from left to right

Navigate to /lib/Zend/Locale/Data folder . Select the xml language file you need, for example it will be the ar.xml for Arabic. Locate this part of code: <currencyFormat> <pattern>¤ #,##...
Qaisar Satti's user avatar
  • 32.5k
4 votes

How to get currency Symbol in magento 2?

<?php class Customclass{ protected $storeManager; protected $currencySymbol; protected $localeCurrency; public function __construct( \Magento\Store\Model\...
Rakesh Jesadiya's user avatar
4 votes
Accepted

Magento2 get all the currencies for default store

You can fetch the Allowed Currencies List using the below Code: public function __construct( /* Add below dependencies */ \Magento\Directory\Model\Currency $currencyModel ) { $this->...
Pankaj Pareek's user avatar
4 votes

Currency switcher not working for currency AED in Magento 2

Finally, issue solved. it was with currency rate. Admin ==> Stores ==> Currency Rates Flush Cache.
Shameem Ali's user avatar
4 votes

Free currency converter fixer.io stopped working

It seems we need to subscribe Basic $10/month plan because Fixer new free plan offers only Euro base currency. If you purchase $10/month plan, you can fix this issue editing: [root]/vendor/magento/...
lizenial's user avatar
4 votes
Accepted

Magento 2 : How to Add Currency Flag to Currency Switcher Dropdown?

You can add the flag to the currency switcher using the below way. create file currency.phtml in app/code/design/frontend/{theme_vendor}/{theme_name}/Magento_Directory/templates/currency.phtml And ...
Kishor Thummar's user avatar
4 votes
Accepted

Magento2 : Redirect store view on the basis of currency switch

I have research and found one solution to this. Suppose you have two store view one for the UK and the second one for the US. The UK is your default store view with GBP currency and you want to change ...
CoderKube Technologies's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible