Magento 2

How to change currency symbol position left to right in Magento 2

A currency symbol is basically a graphical notation that represents particular currency instead of writing the whole name beside price. For business, it’s extremely important to specified But the potion of this graphical notation varies by currency.
Take a look at following example:

Many currencies in the English-speaking world and Latin America place it before the amount like this $10.00 but n many European countries such as France, Germany, Greece, Scandinavian countries, the symbol is usually placed after the amount like this 10.00€.
Also, the decimal separator follows countries and currency standards.

But Magento fails to change position when you change the Currency from the backend. That’s why one of our client and friend asked us to do same. To help more people and to fix this issue quickly, we decided to published an article on our blog.

Create another ‘events.xml’ file inside your folder.
app\code\Vendor\Extension\etc\events.xml

<pre class="lang:default decode:true">
<?xml version="1.0"?>    
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="currency_display_options_forming">
        <observer name="vendor_extension_change_currency_position" instance="Vendor\Extension\Model\Observer\Changecurrencyposition" />
    </event>
</config>
</pre>

Now you need to create another observer file inside extension folder.
app\code\Vendor\Extension\Model\Observer

<pre class="lang:default decode:true">
<?php        
namespace Vendor\Extension\Model\Observer;    
use Magento\Framework\Event\ObserverInterface;    
class Changecurrencyposition implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {    
        $currencyOptions = $observer->getEvent()->getCurrencyOptions();    
        $currencyOptions->setData('position', \Magento\Framework\Currency::RIGHT);  
        return $this;
    }    
}
</pre>

Lastly, Run the following command and you are done.

php bin/magento setup:upgrade

Yes, you have successfully changed the position of currency symbol in store frontend.

Comment down below if you face any issue while using this code.

Happy Swapping!

Click to rate this post!
[Total: 9 Average: 4.1]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

Recent Posts

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

10 hours ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

10 hours ago

Magento 2: How to Add Header and Footer in Checkout

Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…

1 day ago

Understanding Flexbox Layout in React Native

Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…

3 days ago

HYVÄ Themes Releases: 1.3.6 & 1.3.7 – What’s New

We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…

3 days ago

How Modern E-Commerce Platforms Leverage Docker & Kubernetes for Scalability

Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…

4 days ago