lillik / magento2-price-decimal

Magento 2 Extension: Price Decimal Precision
Apache License 2.0
110 stars 68 forks source link

formatPriceLocale in magento 2.4.5 #78

Open stephen-larkbury opened 2 years ago

stephen-larkbury commented 2 years ago

I am getting a console error of formatPriceLocale in magento enterprise 2.4.5, this then prevents the swatch product gallery from working on the product page

verhaeghep commented 2 years ago

I can confirm this issue in magento 2.4.5 Uncaught TypeError: utils.formatPriceLocale is not a function

CptCharlesG commented 2 years ago

I also confirm this with 2.4.5.

Shipping price estimation is also broken including checkout (one step checkout at least).

Also for me the layered navigation did not filter the results until I have removed it with composer.

MikyW commented 1 year ago

As a hotfix I removed /vendor/lillik/magento2-price-decimal/view directory. Prices are still displayed with correct precision in frontend after this change. (I assume this issue will be fixed in next module release so I decided not to use custom module to fix the bug.)

mikimpe commented 1 year ago

I confirm @MikyW 's hotfix works and that it's the way to go.

The content of lillik/magento2-price-decimal/view is:

I have compared the Lillik_PriceDecimal/js/price-utils with the original Magento_Catalog/js/price-utils of the old Magento version (pre 2.4.5) and I found out that it doesn't change anything, it's a simple copy of the original file.

In Magento 2.4.5 Magento_Catalog/js/price-utils was changed, adding the formatPriceLocale function. But, since this module rewrites that file, Lillik_PriceDecimal/js/price-utils is being used instead of the original one and, being a copy of the old version, it doesn't include the new formatPriceLocale function. That's why the "Uncaught TypeError: utils.formatPriceLocale is not a function" error is being triggered.

So, since Lillik_PriceDecimal/js/price-utils had no reason to exist, we can easily drop the lillik/magento2-price-decimal/view and let Magento use its original Magento_Catalog/js/price-utils