cancel
Showing results for 
Search instead for 
Did you mean: 

Price format is overridden incorrectly from JS in the product and checkout page.

Price format is overridden incorrectly from JS in the product and checkout page.

 

 

Language Bulgarian

Currency: BGN

 

This is happening on a new installation without any modifications.

The returned currency format is different in different versions of the INTL module.

 

Magento 2.3, php7.2 

 

<script>
    require([
        'jquery',
        'priceBox'
    ], function($){
        var dataPriceBoxSelector = '[data-role=priceBox]',
            dataProductIdSelector = '[data-product-id=15]',
            priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

        priceBoxes = priceBoxes.filter(function(index, elem){
            return !$(elem).find('.price-from').length;
        });

        priceBoxes.priceBox({'priceConfig': {"productId":"15","priceFormat":{"pattern":"%s\u00a0\u043b\u0432.","precision":2,"requiredPrecision":2,"decimalSymbol":",","groupSymbol":"\u00a0","groupLength":2,"integerRequired":false},"prices":{"oldPrice":{"amount":155,"adjustments":[]},"basePrice":{"amount":155,"adjustments":[]},"finalPrice":{"amount":155,"adjustments":[]}},"idSuffix":"_clone","tierPrices":[],"calculationAlgorithm":"TOTAL_BASE_CALCULATION"}});
    });
</script>

 

The issue is present when the php-intl ICU version is 60.1 or 60.2 

Tested with php 7.1 and 7.2  

2 REPLIES 2

Re: Price format is overridden incorrectly from JS in the product and checkout page.

What I found is that $formatter->getPattern() returns "#0.00 ¤" while the format scpecified in vendor\magento\zendframework1\library\Zend\Locale\Data\bg.xml is 

#,##0.00 ¤
 
<currencyFormats numberSystem="latn">
		<currencyFormatLength>
			<currencyFormat type="standard">
				<pattern>#,##0.00 ¤</pattern>
			</currencyFormat>
		</currencyFormatLength>
	        <unitPattern count="one">{0} {1}</unitPattern>
		<unitPattern count="other">{0} {1}</unitPattern>
</currencyFormats>

 

Re: Price format is overridden incorrectly from JS in the product and checkout page.

Did you found solution for this problem? I have the same issue with new Magento 2 installation and PHP 7.2 . The thousands separator is not working correctly.