1

I am upgrading to 2.4.5-p1

I can't seem to figure out how to resolve this error.

price-box.js:153 Uncaught TypeError: utils.formatPriceLocale is not a function
at $.<computed>.<computed>.<anonymous> (price-box.js:153:41)
at underscore.js:723:29
at Function.each (underscore.js:1335:17)
at $.<computed>.<computed>.reDrawPrices (price-box.js:148:15)
at $.<computed>.<computed>.reloadPrice (widget.js:132:25)
at HTMLDivElement.dispatch (jquery.js:5430:49)
at elemData.handle (jquery.js:5234:47)
at Object.trigger (jquery.js:8719:28)
at HTMLDivElement.<anonymous> (jquery.js:8797:30)
at Function.each (jquery.js:385:35)

Here is the function that is not working:

price.formatted = utils.formatPriceLocale(price.final, priceFormat);

2
  • 4
    Check you check override file price-utils.js in any custom module or theme? formatPriceLocale is not exist before 2.4.5 so add it on your file and also add in return. Commented Nov 14, 2022 at 6:08
  • That was the issue thank you Rutvik Commented Nov 20, 2022 at 1:38

3 Answers 3

2

I faced the same issue when I upgraded one of the website from Magento2.4.4 to Magento2.4.5-p2. After investing lots of hours I debugged the issue so I thought to share my findings here so that It may help other developers with same issue quickly. If you see Magento_Catalog/js/price-utils js file, you will see a function named as formatPriceLocale(), which was not available before Magento2.4.5 so find out all js files overriding Magento_Catalog/js/price-utils in the theme or any custom or third party modules and add the same function to that file from core file. It will resolve the issue.

1

I faced the same issue when I upgraded one of the website from Magento2.4.4 to Magento2.4.5-p2. After investing lots of hours I debugged the issue so I thought to share my findings here so that It may help other developers with same issue quickly. If you see Magento_Catalog/js/price-utils js file, you will see a function named as formatPriceLocale(), which was not available before Magento2.4.5 so find out all js files overriding Magento_Catalog/js/price-utils in the theme or any custom or third party modules and add the same function that file from core file. It will resolve the issue.

0

We had a similar error. Find the module that overrides the price-utils.js file, this module needs to be updated. For this we used the lillik/magento2-price-decimal module.

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.