How to Allow Only One Quantity in Your WooCommerce Store

How to Allow Only One Quantity in Your WooCommerce Store?

There are so many reasons why you might want to limit the quantity of the product you sell to one if you’re selling exclusive items or limited stock or if you want to better control the inventory of your items.

Many reasons could drive you to that decision and to do it there are simple ways and complicated ways, I’ll present you both and leave the decision for you to decide which method you prefer.

Why Limit Your Products to One?

Limiting your products to one quantity can offer several benefits for both your business and your customers. By restricting the quantity of a product, you create a sense of exclusivity and scarcity. Customers are more likely to perceive the product as unique and valuable.

Limited quantities can generate a sense of urgency among customers. The fear of missing out (FOMO) may encourage impulse buying, leading to quicker sales and reduced decision-making time.

Limiting products can enhance their perceived value. Customers may attribute higher value to scarce items, associating rarity with desirability.

For businesses dealing with limited stock or exclusive items, restricting quantities ensures better control of inventory. It helps prevent overselling and ensures that the available stock is distributed among a wider customer base.

Customers appreciate exclusive offerings. Limiting quantities can foster a sense of loyalty among buyers who value your commitment to providing unique and limited products.

Limiting quantities can help prevent price wars among competitors. When a product is perceived as exclusive, customers may be less inclined to base their purchasing decisions solely on price.

How to Limit Quantity Sold to One in A WooCommerce Store?

Method 1: Using A Plugin

  1. Login to your admin dashboard
  2. Go to plugins -> add new
  3. Search for Min Max Default Quantity for WooCommerce
  4. Install & activate the plugin

Add New Plugin

  1. Once the plugin is installed go to WooCommerce -> settings -> product quantity tab


  1. Go to the maximum quantity tab and set the maximum quantity to one, you can set it for all products 

maximum quantity tab

  1. Or if you want to set it per product make sure the ‘per product’ box is enabled and a meta box will show on the product page for each product



The beauty of using a plugin is that anyone could use it, it’s simple and easy and it’s no rocket science and all. It does the job simply and efficiently, and there’s no hassle or risk of breaking anything while using it.

Method 2: Using Custom Code

Custom code is not recommended unless you’re a developer and already have experience in building and editing WordPress plugins to make sure nothing breaks while you’re making these changes.

To implement the restriction of allowing only one quantity per product in your WooCommerce store using custom code, you can add a snippet to your theme’s functions.php file or create a custom plugin. Below is a simple example using the woocommerce_quantity_input_min and woocommerce_quantity_input_max filters. This code limits the quantity to 1 for all products in your store:

// Restrict quantity to 1 for WooCommerce products

function custom_restrict_quantity_to_one($min, $product) {

    return 1;


add_filter(‘woocommerce_quantity_input_min’, ‘custom_restrict_quantity_to_one’, 10, 2);

add_filter(‘woocommerce_quantity_input_max’, ‘custom_restrict_quantity_to_one’, 10, 2);


// Display only one quantity in the cart and checkout

function custom_update_cart_quantity($cart_item_data, $product_id) {

    if (isset($cart_item_data[‘quantity’]) && $cart_item_data[‘quantity’] > 1) {

        $cart_item_data[‘quantity’] = 1;


    return $cart_item_data;


add_filter(‘woocommerce_add_cart_item_data’, ‘custom_update_cart_quantity’, 10, 2);

add_filter(‘woocommerce_update_cart_item’, ‘custom_update_cart_quantity’, 10, 2);


Here’s a breakdown of what the code does:

  1. The custom_restrict_quantity_to_one function is used to set the minimum and maximum quantity to 1. This function is hooked into the woocommerce_quantity_input_min and woocommerce_quantity_input_max filters.
  2. The custom_update_cart_quantity function is used to ensure that only one quantity is allowed in the cart and checkout. If a user attempts to add more than one item to the cart, the quantity is automatically set to 1. This function is hooked into the woocommerce_add_cart_item_data and woocommerce_update_cart_item filters.

To add this code to your WordPress site:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to “Appearance” -> “Theme Editor” if you want to add it to your theme’s functions.php file, or use a custom plugin.
  3. If using the theme editor, find and select the functions.php file on the right-hand side.
  4. Copy and paste the provided code at the end of the functions.php file.
  5. Save the changes.

Remember to test this code on a staging or local environment before applying it to a live site. Also, be aware that modifying code can have unintended consequences, so it’s a good practice to have a backup of your site before making any significant changes.


Limiting the amount sold to one can have multiple motives in your store, it gives a sense of exclusivity to customers which allows for lots of benefits such as setting higher prices, for exclusive items, and it gives also a sense of urgency and fear of missing out (FOMO).

Applying this can be done simply by using a plugin such as Min Max Default Quantity for WooCommerce and following the steps mentioned above in the article, or if you have programming experience it can be done by code by editing the theme files, though this method is not recommended if you’re not a developer, and the plugin is free anyways and will cost you nothing to use it, unless you’ve liked it and want to upgrade to more advanced features.

Leave a Reply

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