We allow users to use commas for decimal separators when that's the default in their language.
That's true for price fields, but not for percentage fields, which come from core.
We'll need our own form element / widget for the percentages.

Comments

bojanz created an issue. See original summary.

nightlife2008’s picture

Steps to reproduce:

1. Set Belgium as store country
2. Set EURO as currency for default store
3. Create a promotion with the following values:
- Order percentage "10" %
- Condition 1: Order total >= 25 euro
4. Save promotion, everything should be OK.

5. Edit promotion, the order total condition value should be changed to "25,00".
6. Change the condition value to "25,50"
6. Save again.

You get the following error:

CommerceGuys\Intl\Exception\InvalidArgumentException: The provided value "25,50" must be a valid number or numeric string. in CommerceGuys\Intl\Formatter\NumberFormatter->format() (line 164 of /var/www/site/vendor/commerceguys/intl/src/Formatter/NumberFormatter.php).

bojanz’s picture

A simpler alternative for the percentage problem could be to enforce whole percentages.
So 15% but no 14.99%
Maybe that's enough for now?

EDIT: Nevermind, we'd still need it for tax percentages which aren't always whole numbers. I'll port the logic from Physical.

  • bojanz committed 573b31a on 8.x-2.x
    Issue #2834627: Promotion percentage can't be provided in the locale-...
bojanz’s picture

Status: Active » Fixed

Fixed. We now have a commerce_number form element for this use case.

Status: Fixed » Closed (fixed)

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