Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #520404

    I realise this is a WooCommerce issue and not caused by the theme so I post this just in case someone knows how, and is kind enough to offer a solution.

    The problem I’d like to solve is:

    if a customer adds a chosen quantity of a grouped item to the cart, then decides to add a quantity of another item in the group, the previously chosen item’s quantity remains and so this is also added. So, the customer must ensure to reduce other items’ quantities to ‘0’ before adding a different item (since there is one ‘Add to Cart’ button for the group). This seems inconvenient and can lead to mistakes.

    To solve this I would like to be able to reset all product quantities to ‘0’ once added to cart.

    I’ve tried adding the following code to functions.php but this also affects the quantities shown in the cart. If I could exclude products displayed in the cart, I think that would solve my problem:

    // Simple products 
    add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); 
    function jk_woocommerce_quantity_input_args( $args, $product ) { 
    $args['input_value'] = 0; // Starting value 
    $args['max_value'] = 10; // Maximum value 
    $args['min_value'] = 0; // Minimum value 
    $args['step'] = 1; // Quantity steps 
    return $args; 
    // Variations 
    add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); 
    function jk_woocommerce_available_variation( $args ) { 
    $args['max_qty'] = 10; // Maximum value (variations) 
    $args['min_qty'] = 0; // Minimum value (variations) 
    return $args; 

    I hope this makes sense and someone can offer a solution.


    Hey Leosoki!

    Sounds like a Woocommerce issue. You will want to contact Woocommerce support to help you out with this customization,

    Best regards,

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.