• Resolved Pityvert

    (@pityvert)


    Hi,
    when people add multiple items into their cart, the fly cart pops up with the correct price but the wrong quantity. When preceding to the checkout page the quantity is right.
    Thank you,
    Pierre

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @pityvert,

    I’ve checked your site and found that the quantity of products in the cart showed correctly
    If you still need help, pls send us the detailed screenshots of the issue as well as specific public product link for us to check and help you.

    Regards,

    Thread Starter Pityvert

    (@pityvert)

    Hi thank you for your quick answer.
    the error still seem to be there.

    it seems that the following code is causing the issue:

    add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 10, 2 );
    function custom_quantity_input_args( $args, $product ){
        if ( has_term( array('Menu'), 'product_cat', $product->get_id() ) ) {
            if( ! is_cart() ) {
                $args['input_value'] = 2; // Starting value
            }
            $args['min_value'] = 2; // Minimum value
            $args['max_value'] = 10; // Maximum value
    		$args['step'] 		= 2;    // Quantity steps
    
        }
        return $args;
    }
    
    // For Ajax add to cart button (define the min value)
    add_filter( 'woocommerce_loop_add_to_cart_args', 'custom_loop_add_to_cart_quantity_arg', 10, 2 );
    function custom_loop_add_to_cart_quantity_arg( $args, $product ) {
        if ( has_term( array('Menu'), 'product_cat', $product->get_id() ) ) {
            $args['quantity'] = 2; // Min value
    
        }
        return $args;
    }
    
    // For product variations (define the min value)
    add_filter( 'woocommerce_available_variation', 'custom_available_variation_min_qty', 10, 2);
    function custom_available_variation_min_qty( $data, $product, $variation ) {
        if ( has_term( array('Menu'), 'product_cat', $product->get_id() ) ) {
            $args['min_qty'] = 2; // Min value
    
        }
    
        return $data;
    }

    Can you see what would be the conflict?

    Thread Starter Pityvert

    (@pityvert)

    *** found the answer ***
    needed to remove this line of code: $args[‘input_value’] = 2; // Starting value
    sorry for taking up your time.

    Having the same issue. Items have to be added twice before they appear.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fly cart quantity not updating’ is closed to new replies.