Magento2: Wrong price format when it is loaded by JS file

Created on 26 Aug 2016  Â·  12Comments  Â·  Source: magento/magento2

Preconditions

  1. Magento 2.1.0, PHP 7.0.8

    Steps to reproduce

  2. Set the store locale to es_XX

  3. View any product page

    Expected result

  1. Price should be diplayed in the right format: 1,599.00

Actual result

  1. Price is displayed in the wrong format: 1.599,00
Translation Clear Description Format is valid Ready for Work bug report

All 12 comments

Hi! Why do you think it is wrong? According to standards separators in es_XX locale are opposite to en_XX. See example https://en.wikipedia.org/wiki/Decimal_mark#Examples_of_use

@sevos1984 I'm from Mexico, we use the decimal dot. You can see that in the first row from that wikipedia table.
For Spain they do use the comma separator.

I'd like to highlight that the issue is only present when price is loaded by JS, anywhere else in the store and backend, the price format is ok.

Thanks for clarification, internal ticket created MAGETWO-57833

@sevos1984 Is there a temporary solution for this? If so, could you share it here? I'm sorry to ask here but I haven't found a solution anywhere else.

I don't have any but use another locale.

Hi, for local usage wikipedia is correct, but not for international usage: Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator. In this case how can I change price just for product detail page: 1,599.00 € ?

any update on this issue.? i can able to change in product view page . but still i am not able to change in product details page. ?can any tell me where to change .?

@fazilpm I think there is not a solution yet. However, you can solve it by using the United States locale and name your translation file en_US.csv

@lgarridoj can you please tell me where is the location of the file en_US.csv

@fazilpm you have to create it and configure Magento to use that locale. You can find all information about translation in the official magento documentation website

Although this is not a correct solution you can override vendor/magento/framework/Locale/Format.php to fix the currency format to your choosing, after $groupSymbol definition (around line 124), localeCode should be the target locale.

// MODIFICATION TO CORE FILE, TO FIX ISSUE WITH CURRENCY FORMAT
if($localeCode == 'es_MX'){
$decimalSymbol = '.';
$groupSymbol = ',';
}

@lgarridoj, thank you for your report.
The issue is already fixed in develop branch, 2.2.0

Was this page helpful?
0 / 5 - 0 ratings