I need to change the price format in product page, i already try to do this

# vendor/magento/zendframework1/library/Zend/Locale/Data/vi.xml
<symbols numbersystem="latn">

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

# vendor/magento/module-directory/Model/Currency.php
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

# vendor/magento/module-sales/Model/Order.php
public function formatPrice($price, $addBrackets = false)
    return $this->formatPricePrecision($price, 0, $addBrackets);

And this work for most of my site. like category page & order & cart & checkout but it wont work with product page.

can u help me with that please ?

I need to change the price format.

1 Answer 1


This can be done with a rewrite of the \Magento\Framework\Locale\Format class. To do this create a custom module with a di.xml file. In this file create a preference for the \Magento\Framework\Locale\Format class like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Framework\Locale\Format" type="Namespace\Module\Model\Locale\Format" />

Now in your custom module create the file you refer to Namespace\Module\Model\Locale\Format with this code in it:


namespace Namespace\Module\Model\Locale;

class Format extends \Magento\Framework\Locale\Format
    public function getPriceFormat($localeCode = null, $currencyCode = null)
        // Force the locale to create your desired price format
        $localeCode = 'nl_NL';
        return parent::getPriceFormat($localeCode, $currencyCode);
  • There was an extension force the price to look like this .. sorry for your time bro :-) May 12, 2018 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.