• ResolvedPlugin Contributor Marc Queralt i Bassa

    (@marcqueralt)


    I’ve been experimenting problems on minus button when value-step<min. I did those changes to solve it.

    $('.woocommerce .quantity').on('click', '.minus', function (e) {
            var qty = $(this).parent().find('input.qty');
            var val = parseInt(qty.val());
            var step = parseInt(qty.attr('step'));//Modified
            var min = parseInt(qty.attr('min'));//Modifien
    
            if ('undefined' !== typeof (min) || val > min) {
                step = 'undefined' !== typeof (step) ? parseInt(step) : 1;
    
                if (val - step >= min) {//Modified
                    qty.val(val - step).change();
                }
            }
        });

    I did the equivalent ones in the second part of the script.
    Hope it helps.

Viewing 1 replies (of 1 total)
  • Plugin Author Niels Lange

    (@nielslange)

    @marcqueralt Thanks for your code snippet! This is very helpful and I just merged it into the latest release of the plugin. Due to your contribution, I also added you as a contributor. ??

Viewing 1 replies (of 1 total)
  • The topic ‘JQuery does not take into account min when using step’ is closed to new replies.