How to set product quantity, minimum value and increment amount in Woocommerce?

In this tutorial, We’ll learn how to set initial quantity, minimum value, maximum value and increment amount for products in woocommerce.

Default values are:

Quantity => 1
Minimum Value => 1
Maximum Vale => Any Quantity
Increment Amount => 1
We can change one to all of these values. To do this add the following lines of code at the end of your theme’s functions.php file:
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 );
function jk_woocommerce_quantity_input_args( $args, $product ) {
   $args['input_value']    = 2;         // Starting value
   $args['max_value']                      = 80;      // Maximum value
   $args['min_value']                       = 2;         // Minimum value
   $args['step']                   = 2;   // Quantity steps
   return $args;
// Variations
add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' );
function jk_woocommerce_available_variation( $args ) {
                $args['max_qty'] = 80;                   // Maximum value (variations)
   $args['min_qty'] = 2;                   // Minimum value (variations)
   return $args;

You can access functions.php file here;


First function is for simple products and second for variable products. Every array field is self-explanatory and you can change that to any value you want.

Now if you add product to cart from archive page and go to cart page you’ll see initial quantity i.e. 2.



On the product page, initial quantity will be set.


And if you enter the quantity less than minimum quantity or greater than maximum quantity, you’ll see a notice to change quantity accordingly.

That is all for now.


Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

6 thoughts on “How to set product quantity, minimum value and increment amount in Woocommerce?

  1. I looked everywhere for this, thank you very much for this buddy. I have only one concern: When you edit the $args[‘input_value’], $args[‘max_value’], $args[‘min_value’], $args[‘step’] the number you increment by ( In my case 250 ) it isn’t carried to the checkout. The default number is instead brought over. So instead of having for example: 3000 of one item and then selecting “Add to cart”, the cart does not show 3000 of that item, it shows 250. Is there any way around this?

    1. Here is the Solution for You.

      add_action( ‘woocommerce_check_cart_items’, ‘woocommerce_check_cart_quantities’

      function woocommerce_check_cart_quantities() {

      $multiples = 250;

      $total_products = 0;

      foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {

      $total_products += $values[‘quantity’];


      So it basically does the math of Number of Increments x Base value, so in my
      case 12 x 250 = 3000.
      This value is carried to the Cart and the price is also corrected. Works well
      with dynamic pricing as well.

  2. Thank you so much, this is great!

    Variable products still show as “1” when I set the input_value to 0 though.

    Thanks again for sharing.

  3. Hello guys!
    Thank you for the great tutorial!
    I have one question though, and it is about the add to cart quantities:
    I am wondering, is it possible to have multiple options when adding quantities as shown here:
    So first button would be 1, second 2 and third option would be to enter quantity manually where first option would be 3 or more (if added manually).
    Thanks in advance!

Leave a Reply

Your email address will not be published. Required fields are marked *