Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Olybop

    (@olybop)

    ok it’s my function for my minus button… :/

    jQuery(document).ready(function($){   
              
                $('form.cart').on( 'click', 'button.plus, button.minus', function() {
     
                // Get current quantity values
                var qty = $( this ).closest( 'form.cart' ).find( '.qty' );
                var val   = parseFloat(qty.val());
                var max = parseFloat(qty.attr( 'max' ));
                var min = parseFloat(qty.attr( 'min' ));
                var step = parseFloat(qty.attr( 'step' ));
     
                // Change the value if plus or minus
                if ( $( this ).is( '.plus' ) ) {
                   if ( max && ( max <= val ) ) {
                      qty.val( max );
                   } 
                else {
                   qty.val( val + step );
                     }
                } 
                else {
                   if ( min && ( min >= val ) ) {
                      qty.val( min );
                   } 
                   else if ( val > 1 ) {
                      qty.val( val - step );
                   }
                }
                 
             });
              
          });
    Plugin Author wpgear

    (@wpgear)

    But you could just set “Min cart Quantity” = 1.0 & “Step change Quantity” = 0.1

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘decimal of 0.1 step’ is closed to new replies.