Skip to content

Incorrect price formatting for configurable products in sl_SI and it_IT locales — missing thousand separator due to wrong formatter in price-box.js #40357

@KntQ

Description

@KntQ

Preconditions and environment

  • Magento versions tested: 2.4.5, 2.4.6, 2.4.7 (clean installations without custom pricing modules)
  • Storefront locales tested:
    • sl_SI (Slovenian)
    • it_IT (Italian)
  • Currency formatting (as configured in Magento):
    • decimalSymbol: ","
    • groupSymbol: "."
    • groupLength: 3
    • pattern: "%s €"
  • Simple product prices are formatted correctly (server-side ICU formatting).
  • Issue affects only configurable products (client-side JS formatting via price-box.js).

Note:
The issue is fully confirmed for sl_SI and it_IT.
However, since the root cause is the use of utils.formatPriceLocale (which does not honor thousand separators for multiple EU locales), the bug may also affect additional European locales that use decimal commas and thousand separators. Only sl_SI and it_IT were explicitly tested.

Steps to reproduce

  1. Install Magento 2.4.x with sl_SI or it_IT set as the storefront locale.
  2. Configure currency formatting:
    • Decimal symbol: ","
    • Thousand separator: "."
    • Group length: 3
  3. Create a configurable product (e.g., size or color variations).
  4. Open the product page on the storefront.
  5. Observe the price:
    • Immediately on page load,
    • After selecting any configurable option,
    • After changing swatches or variations.
  6. Compare this with the formatting of a simple product viewed under the same locale.

Expected result

Price should be formatted according to Magento’s priceFormat configuration, e.g.:

4.500,00 €

— Correct thousand separator
— Correct decimal separator
— Consistent with ICU formatting
— Identical behavior across simple and configurable products

Actual result

Configurable product price is rendered as:

4500,00 €

— Thousand separator is missing
— Formatting differs from simple products
— Behavior affects sl_SI and it_IT locales specifically
— Simple products display correct formatting (server-side ICU)
— Configurable products rely on JS, where incorrect formatting is produced

Investigation shows that price-box.js uses:
utils.formatPriceLocale(price.final, priceFormat);

Instead of the correct:
utils.formatPrice(price.final, priceFormat);

formatPriceLocale does not correctly honor the thousand separator logic for these locales.

Additional information

Root Cause:
In app/code/Magento/Catalog/view/base/web/js/price-box.js, configurable product prices are formatted using:

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

This is incorrect, as formatPriceLocale does not process the thousand separator (groupSymbol) properly for locales such as sl_SI and it_IT.

Correct behavior is achieved by using:

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

Debugging results:

  • utils.formatPrice(4500, priceFormat) → returns correct 4.500,00 €
  • DOM receives → 4500,00 €
  • Stack trace confirms incorrect HTML injected from price-box.js:155

Minimal suggested core fix (1 line change):

Replace: utils.formatPriceLocale(...)
With:    utils.formatPrice(...)

Workaround verified:
A RequireJS mixin overriding reloadPrice() to use formatPrice fixes the formatting entirely, confirming the root cause is in core JS.

Since the bug may also affect other locales with decimal comma and thousand separator formats (e.g., certain EU regions), the impact could be broader than sl_SI and it_IT.

Release note

Fixed incorrect price formatting for configurable products when using sl_SI and it_IT locales. The core price-box.js incorrectly used formatPriceLocale, which does not apply thousand separators for these locales. Updated to use formatPrice for consistent and correct price formatting across all locales and product types.

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Ready for Confirmation

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions