feat(plugin-ecommerce): add locale-aware currency formatting and symbol positioning#15139
feat(plugin-ecommerce): add locale-aware currency formatting and symbol positioning#15139teastudiopl wants to merge 3 commits intopayloadcms:mainfrom
Conversation
|
I reviewed the code and it seems to me that the symbolPosition argument is essentially useless? This would be because this switches formatting to the Intl API which will handle any nuances here, we can keep the symbol in the type as we can use that in the custom input component. For the cell we can refactor a utility out so it's formatting the number using the Intl API as well. What do you think? @teastudiopl |
|
Good point. I can refactor the cell and extract a shared utility based on Intl.NumberFormat. |
|
Yes please, though for now don't do a shared utility, just copy it across and add a comment that it's similar to the other as I'm not sure we should have cross imports for bundling reasons. The code in the react folder should be independent until I can confirm it's safe (or we do an export from /shared in the future) |
|
OK, you can verify it now. |
4830a01 to
f1542e9
Compare
|
@paulpopus Any news about this PR? usage in Price component: currencies config |
f1542e9 to
97ac0da
Compare
This PR introduces automatic, locale-aware currency formatting using the native Intl.NumberFormat API.
It also standardizes currency symbol positions and separators across the frontend, ensuring consistent price display for different currencies in Payload e-commerce.
Changes
Automatically handles:
2. Currency display settings
Standardized symbol placement and separator:
Ensures correct rendering for currencies that place the symbol before (EUR, USD, GBP) or after (PLN).
3. Predefined currencies
Updated standard currency definitions:
4. Example: currenciesConfig in Payload