Set the Minimum Quantity for WooCommerce Products with Code Snippets – Elementor WordPress Tutorial

by | Jul 8, 2022 | 0 comments

Set the Minimum Quantity for WooCommerce Products with Code Snippets – Elementor WordPress Tutorial

by | Jul 8, 2022 | Free Wordpress Plugins | 0 comments



Super simple way to Set the Minimum Quantity for WooCommerce Products with Code Snippets.

Add this to Code Snippets:

/**
* Code snippet: Set the Minimum, Maximum, and Start Value to Cart Quantity
*/

add_filter( ‘woocommerce_quantity_input_args’, ‘njengah_woocommerce_quantity_changes’, 10, 2 );

function njengah_woocommerce_quantity_changes( $args, $product ) {

if ( ! is_cart() ) {

$args[‘input_value’] = 5; // Start from this value (default = 1)

$args[‘max_value’] = 1000; // Max quantity (default = -1)

$args[‘min_value’] = 1; // Min quantity (default = 0)

$args[‘step’] = 1; // Increment/decrement by this value (default = 1)

} else {

// Cart’s “min_value” is already 0 and we don’t need “input_value”

$args[‘max_value’] = 1000; // Max quantity (default = -1)

$args[‘step’] = 1; // Increment/decrement by this value (default = 0)

// COMMENT OUT FOLLOWING IF STEP < MIN_VALUE

// $args[‘min_value’] = 4; // Min quantity (default = 0)

}

return $args;

}

—————————————————–
– Get Code Snippets:
– Get Elementor Pro:
– Get Elementor Cloud Hosting:
– Support us:
– Mastery Membership:

Hire us to work on your Website!
Contct us at [email protected] or visit

– Facebook:
– LinkedIn:
– Instagram:
– Twitter:

—————————————————–
Equipment Used:
Softbox Lighting Kit (to focus main light onto me in a dark room):

Soundproof Panels (to provide a dark setting, and prevent sound bounce):

3m Ethernet Cat 7 Cable (to maximise the Internet Connection as the room is upstairs):

Anker 6 in 1 Adaptor (for the Macbook Air to increase USB-C, USB-A, HDMI, Ethernet Ports):

USB-C to Lightning Port Cable (from my iPhone to my Macbook Air):

Powerline Adaptor (boosts internet connection from downstairs 380mbs to the upstairs room 120mbs):

Floodlights (positioned to glow onto the walls):

LED Light stands (either side of me):

Fifine Dynamic Microphone:

Floating Shelves:

Hanging Pendant Light Holders:

Vintage Light Bulbs:

source