Magento 2.1.5 – How to Add Decimal Number to Price

magento2.1.5

How to add third decimal point to products, orders, tax, shipping price in both frontend and backend ?

Ex:

Product: 12.55$   ==>   12.550$

Best Answer

In Magento2, there are different ways you can get this,

by Using this code inside your view file(.phtml)

$this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format(7,3),true,false);

This means there can be 7 digits to the left of the decimal point (7-3) and 3 to the right of the decimal point.

OR

This worked in Magento 2.1: Look in

/vendor/magento/framework/Pricing/PriceCurrencyInterface.php

Change const DEFAULT_PRECISION = 2;

To const DEFAULT_PRECISION = 3;

Edit For this you could go for module like this one.

Then flush cache.

Hope this will help.

Related Topic