Default formatting of price

Hello,

I have a price field that displays the price in this format:
CHF 5’000.00

So if someone enters 5000.00 in this field, it will automatically be displayed as CHF 5’000.00 (which is correct).

However, if someone mistakenly enters the price as 5000,00 (with a comma for the decimal places), the price will be converted to CHF 500’000.00 (which is incorrect).

Is it possible to replace the comma so that the price is correctly converted as CHF 5’000.00 and always using the formatting with a point for the decimals?

Thanks for your help,
Michael

Hi Michael,

I’ve just checked to confirmed and found I’ve helped you regarding this issue before. Are you having any issue to use my previously provided code? If so, please let me know the details so I can help to resolve the issue. Thank you

Hi Faisal,

thanks for your response.

No, the last time it was about the weight decimal separators. This time I wanted to do the price decimal separators.

Or can I use the same code and adapt it?

Thanks, Michael

Hi Michael,

Please try the existing code. If it doesn’t work, I’ll help you figure it out tomorrow. Please share the exact webpage URL to check the form so I can rewrite a personalized code for you if needed. Thank you.