Woocommerce Plus and Minus button Doesn’t Work On Ajax Update On Cart Page

Share Now

In order to fix it, you need to add an event for the AJAX calls.
I also added .off() so the value won’t add itself multiple times after every AJAX call.

jQuery(document).ajaxComplete(function() {

    $('.woocommerce-cart .quantity').change(function() {
        if ($(this).val != '') {
            $('button[name="update_cart"]').removeAttr('disabled');
        }
    });

    jQuery('.woocommerce-cart .quantity').off('click', '.plus').on('click', '.plus', function(e) {
        $input = jQuery(this).prev('input.qty');
        var val = parseInt($input.val());
        $input.val(val + 1).change();
    });

    jQuery('.woocommerce-cart .quantity').off('click', '.minus').on('click', '.minus',
        function(e) {
            $input = jQuery(this).next('input.qty');
            var val = parseInt($input.val());
            if (val > 1) {
                $input.val(val - 1).change();
            }
        });

});
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert