• Resolved Riccardo91

    (@alopex91)


    Hi, on my website I changed the step quantity to 0.5 but it seems it doesn’t work on the quantity box of this plugin, it seems independent, it is not affected by plugins or code, is it possibile to fix it so I can use decimal step quantity on the plugin quantity box?

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Vidish

    (@vidishp)

    @alopex91 Thank you for reaching out. May I know how have you changed step quantity on your site?

    Thread Starter Riccardo91

    (@alopex91)

    @vidishp Hi, I used “Min Max Quantity & Step Control for WooCommerce” but I also used some script in functions.php in the past.

    Plugin Author Vidish

    (@vidishp)

    @alopex91 Unfortunately we do not offer support for third party plugins. However, if you can let me know which filter you have used for step quantity, then I can try accommodating it in plugin, if it is from woocommerce core.

    Thank you!

    Thread Starter Riccardo91

    (@alopex91)

    @vidishp Hi, I’m no php expert but it should look something like this

    add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); // Simple products
    
    function jk_woocommerce_quantity_input_args( $args, $product ) {
    	if ( is_singular( 'product' ) ) {
    		$args['input_value'] 	= 2;	// Starting value (we only want to affect product pages, not cart)
    	}
    	$args['max_value'] 	= 80; 	// Maximum value
    	$args['min_value'] 	= 2;   	// Minimum value
    	$args['step'] 		= 2;    // Quantity steps
    	return $args;
    }
    
    add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
    
    function jk_woocommerce_available_variation( $args ) {
    	$args['max_qty'] = 80; 		// Maximum value (variations)
    	$args['min_qty'] = 2;   	// Minimum value (variations)
    	return $args;
    }

    In my specific case I needed to change the step quantity to 0.5

    Thread Starter Riccardo91

    (@alopex91)

    Thread Starter Riccardo91

    (@alopex91)

    Plugin Author Vidish

    (@vidishp)

    @alopex91 I have released a version 2.1.8 with this feature. Also, you will need to add this code to your functions.php file:

    add_filter('woocommerce_quantity_input_step', 'wooextend_change_step_value', 10, 2);
    function wooextend_change_step_value( $step, $product ) {
    
    	$step = 2;
    
    	return $step;
    }

    I hope this helps!

    Thank you!
    Vidish

    • This reply was modified 3 years ago by Vidish.
    Thread Starter Riccardo91

    (@alopex91)

    This works to the combo quantity, not for single product quantity inside it. It’s still integers.

    Plugin Author Vidish

    (@vidishp)

    @alopex91 I have checked and the update is for child products’ quantities. Not for main product’s quantity.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘About Step Quantity functionality’ is closed to new replies.