Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatPriceLocale in magento 2.4.5 #78

Open
stephen-larkbury opened this issue Aug 5, 2022 · 4 comments
Open

formatPriceLocale in magento 2.4.5 #78

stephen-larkbury opened this issue Aug 5, 2022 · 4 comments

Comments

@stephen-larkbury
Copy link

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
Copy link

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

@CptCharlesG
Copy link

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
Copy link

MikyW commented Oct 27, 2022

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
Copy link

mikimpe commented Nov 10, 2022

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

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

  • frontend/requirejs-config.js: it makes a rewrite of Magento_Catalog/js/price-utils replacing it with Lillik_PriceDecimal/js/price-utils
  • frontend/web/js/price-utils.js: the rewrite itself

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants