Describe your bug or feature request.

The price amount validation is breaking the number format on the decimal point when using the same number formatting for all languages.
In our scenario, we want to use the decimal point "." for all possible languages of the site. The validation removes the decimal point "." if the language's default decimal point is "," for example.

If a bug, provide steps to reproduce it from a clean install.

  • Add a product with danish language
  • Add a number amount that accepts number input
  • In the variation form, enter 5.5
  • The price in the cart will have 55 instead

Proposed Solution

The parse() function already accepts the $options['locale'] so I suggest to add the #locale option to the render array and pass it in validateForm() if it's set.

Issue fork commerce-3491248

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

abdelrahman khlefat created an issue. See original summary.

abdelrahman khlefat’s picture

Issue summary: View changes
jsacksick’s picture

The MR should target the 3.x branch. 8.x-2.x is no longer maintained.

jsacksick’s picture

Version: 8.x-2.0 » 3.0.x-dev

abdelrahman khlefat changed the visibility of the branch 3491248-validation-is-breaking to hidden.

abdelrahman khlefat changed the visibility of the branch 3491248-add-option-to-add-specific-locality-to-price-format to hidden.

abdelrahman khlefat’s picture

Created a new branch taken from v3 with the previous diff

abdelrahman khlefat’s picture

Assigned: abdelrahman khlefat » Unassigned
Status: Active » Needs review

jsacksick’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.