Skip to main content

How to Change Currency Symbol Position - Magento 2

The default Magento 2 shows the currency symbol on the left side. However it does not have a feature to change the currency location from left to right. 
 
Programmatic solution to change currency symbol position in Magento 2.
 
Solution to Change Currency Symbol Position in Magento 2

Create events.xml file at app/code/vendor/Exenstion/etc/frontend
 
<?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="change_currency_position" instance="vendor\Exenstion\Observer\ChangeCurrencyPosition"/>
    </event>
</config> 


Create ChangeCurrencyPosition.php file at app/code/vendor/Exenstion/Observer
 
 
 <?php

namespace vendor\Exenstion\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;

    }
}

Comments

  1. You've written an excellent post, and you've shared it with us about Magento Development Services. Your article provided me with some unique and useful knowledge. I appreciate you sharing this text with us.

    ReplyDelete
  2. Best Betting Sites in South Africa - JtmHub
    Betway has been around since 2016 and 광명 출장샵 is one of the best 익산 출장샵 betting sites in South Africa. 포항 출장마사지 They have a great selection of banking options 경주 출장샵 and a huge 포천 출장샵 range of

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete

Post a Comment