If you find that product quantities change after a user adds an item to their cart, you can use the following snippet to reset all quantities to a certain default value, e.g. 1:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_reset_table_quantity( $args, $product ) { | |
$args['input_value'] = 1; | |
return $args; | |
} | |
add_filter( 'woocommerce_quantity_input_args', 'prefix_reset_table_quantity', 10, 2 ); |
Here’s how to add a snippet.