Forums › Min Max Default Quantity for WooCommerce › Validation issue with existing orders after quantity rule updates
- Support forum for the WooCommerce Quantity Manager – Min Max Step Quantities Plugin.
- This topic has 1 reply, 1 voice, and was last updated 4 months, 2 weeks ago by
Alessio.
-
AuthorPosts
-
September 22, 2025 at 11:41 am #172909
Alessio
ParticipantHello team,
I’m experiencing a validation issue in the WooCommerce back-end that prevents me from saving existing orders. The error occurs after updating product quantity rules (min/max) with your plugin.
<b>Problem Description:</b> When attempting to update an old order that does not comply with the new quantity rules, the browser displays an HTML5 validation error:
An invalid form control with name='order_item_qty[86]' is not focusable.This happens because the order item quantity fields (
<input type="number">) haveminormaxattributes that are incompatible with the current value. Concurrently, these fields are rendered as “not focusable,” likely due to CSS or JavaScript.The browser blocks the form submission because it cannot focus the field to show the user the error, effectively preventing any changes to the order from being saved.
I’ve noticed a setting in your plugin called “Replace woocommerce quantity field template.” It appears that when this option is disabled, native browser validation takes over, causing this conflict.
Could you provide a solution or a patch to fix this issue? A possible solution might be to either disable HTML5 validation on the order edit form or to handle the validation with JavaScript even when the “Replace woocommerce quantity field template” option is turned off.
Thank you for your support.
Best regards,
Alessio
September 22, 2025 at 2:23 pm #172913Alessio
ParticipantI’m writing to provide an update on the order validation issue I reported. I found a temporary solution that unblocks order saving, and I wanted to share it with you.
The problem stems from the browser’s native HTML5 validation on HPOS order edit pages. It triggers on
<input type="number" />fields with values that don’t conform to themin,max, orsteprules set by your plugin. Because the fields are also “not focusable,” the browser completely blocks the save process.To work around this, I’ve injected a JavaScript script that removes the validation attributes from the quantity fields when the <b>”Update”</b> button is clicked. I added this code to my
functions.phpfile to ensure it only runs on order edit pages:<hr />
function fix_quantity_validation_issue() { $is_wc_order_page = (isset($_GET['page']) && $_GET['page'] === 'wc-orders' && isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id'])); if (!$is_wc_order_page) { return; } ?> <script type="text/javascript"> jQuery(document).ready(function($) { $('.save_order').on('click', function(e) { $('input.quantity[type="number"]').each(function() { $(this).removeAttr('min'); $(this).removeAttr('max'); $(this).removeAttr('step'); }); }); }); </script> <?php } add_action('admin_footer', 'fix_quantity_validation_issue');<hr />
This solution allows me to save existing orders and confirms that the issue is a client-side validation conflict, not a back-end error. I hope this helps you in developing a permanent patch for your plugin.
Thanks again for your support.
Best regards,
Alessio
-
AuthorPosts
- You must be logged in to reply to this topic.