How to change minimum quantity in administration panel of order

101 Views Asked by At

With Enable decimal quantities and stock for WooCommerce products answer code, I changed the step of product quantity fields in my Woocommerce shop.

The problem which now occurs, is that if the quantity is a float value, in the administrative view of the order, the order cannot be updated with the following console error:

An invalid form control with name='order_item_qty[]' is not focusable.

Can someone tell me what filter I need to add in order to change the minimum quantity? Or how I can bypass the validation there?

1

There are 1 best solutions below

0
On BEST ANSWER

I have found a solution, the issue was the step from the order in administration view was 1 instead of 0.1.

The solution:

add_filter( 'woocommerce_quantity_input_step', 'filter_woocommerce_quantity_input_step', 10, 2 );
function filter_woocommerce_quantity_input_step($arg, $product) { 
    $arg = 0.1;
    return $arg; 
};