It seems that if a user enters a comma in the quantity field (as in 2,000) the system ignores the figures after the comma and will add just the amount before the comma (ie '2').

Is there a way to prevent this happening?

(version 2.4.1)

3 Answers 3


You should be able to use HTML5 form validators such as

<input type="number" name="item_qty">

My friend-o, I would make use of this addon's extension hooks. You would want to create an extension that hooks to one of these:


Like this one:


And then parse and modify the quantity value of the form_params variable array where the item quantity value most likely lives. Regular Expression out the commas, or even easier, string replace with an empty value!



Not the best solution by any means, but you can also use JS to prevent anything but numbers and decimal points from being entered. I do this on CC forms.

$('#fieldID').on('keypress', function(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
return !(charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.