Woocommerce Cart Update Plus/Minus Button Not Working

Share Now

# Add this code in js

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

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

# On the product page minimum product can be 1, not 0. Issue fix.
Add this code in JS

if ($('.single-product .qty').val() == 1) {
    $(".minus").attr("disabled", true);
}

$('.single-product .quantity').on('click', function() {

    if ($('.single-product .qty').val() == 1) {
        $(".minus").attr("disabled", true);
    } else {
        $(".minus").attr("disabled", false);
    }

});
Picture of Nahid Mahamud

Nahid Mahamud

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