I used the following to change minimum product quantity for cart page:
add_filter( 'woocommerce_quantity_input_args', 'custom_cart_min_qty', 10, 2 );
function custom_cart_min_qty( $args, $product ) {
$args['min_value'] = 1;
return $args;
}
This time instead of changing min, I would like to read max value on both product and cart page (there would be a loop for all cart products I understand) and then use this information to decide whether to display quantity increment buttons for fields or not. I would like not to display them when maximum quantity is 1 (even if min = 0) or when min quantity = maximum quantity.
LoicTheAztec mentioned than equal min and max will hide input field, it is a very valuable information, kind of complicates things for me even more and I created a separate question for it:
I could write jQuery script to do the job, but I need PHP solution in order to avoid page load flash.
Input field with quantity buttons on product and cart page have the following HTML structure, after I've inserted these buttons using WooCommerce hooks:
<div id="qib-container">
<button type="button" class="minus qib-button">-</button>
<div class="quantity">
<label class="screen-reader-text" for="quantity_5ce95c090e36b">Product name</label>
<input type="number" id="quantity_5ce95c090e36b" class="input-text qty text" step="1" min="1" max="120" name="quantity" value="1" title="Qty" size="4" inputmode="numeric">
</div>
<button type="button" class="plus qib-button">+</button>
</div>
Sorry for the confusion and please let me know if additional information is needed.