• Hello!

    For my Woocommerce Shop, I need individual start quantities for products (e.g. = 2). But the allowed min quantity shall still be the default of 1.

    With the plugin
    woocommerce-incremental-product-quantities
    I can set individual minimum product quanities, which automatically also sets the default quanitiy of the product/category to the minimum value. So this plugin does so far what I need, but with the drawback that i cant go under the minimum value.

    I thought there must be a simple restriction when you hit the “-” in the product cart, which normally doesn’t allow to go under 1, but with this plugin doesn’t allow to go under the desired minimum

    Now in the plugin, I found the ipq_input_value_validation.js which contains the code

    $(".qty").change(function() {
    
    (....)
    
    		// Min Value Validation
    		} else if ( +new_qty < +min && min != '' ) {
    			new_qty = min;
    		}

    which seems to set the quantity back to min, in case the user selects something less the minimum. But changing this code doesn’t change anything, even deleting the whole js.

    So I thought, the value of min qty is maybe proceeded to woocommerce and woocommerce then takes care of the same. So in the woocommerce plugin there is a
    \assets\js\frontend\woocommerce.js

    containing the code

    jQuery( function( $ ) {
    	// Orderby
    	$( '.woocommerce-ordering' ).on( 'change', 'select.orderby', function() {
    		$( this ).closest( 'form' ).submit();
    	});
    
    	// Target quantity inputs on product pages
    	$( 'input.qty:not(.product-quantity input.qty)' ).each( function() {
    		var min = parseFloat( $( this ).attr( 'min' ) );
    		if ( min >= 0 && parseFloat( $( this ).val() ) < min ) {
    			$( this ).val( min );
    		}
    	});
    });

    But also here, I can’t achieve any change.

    Has anyone an idea?

    Thanks a lot in advance!

The topic ‘[Woocommerce] individual product default quantity’ is closed to new replies.