SavyCoder

4 mins read

How to WooCommerce Disable Quantity Change in Cart? Easy Way

WooCommerce disable quantity change in cart.

How to WooCommerce disable quantity change in cart? The “quantity change” feature on the cart page is crucial as it allows customers to adjust the number of items they want to purchase before checkout. However, this feature may not be suitable for stores selling subscription-based or limited-stock items.

Therefore, store owners often prefer to disable or remove this feature to simplify the checkout process for customers and increase their satisfaction.

Disabling or removing the quantity change feature is easy, and this article will provide you with a step-by-step guide to removing this feature on your WooCommerce cart page. Moreover, we will also explain how to remove this feature from a single product page.

woocommerce disable quantity change in cart

How to WooCommerce Disable Quantity Change in Cart?

There are two primary methods to achieve this functionality: editing your theme’s functions.php file or using a custom plugin. We’ll cover both approaches.

Here’s a list of all the topics discussed in this post. Feel free to click on any of them to jump directly to the section you’re most interested in. 

Method 1: Using WooCommerce Filter

In this method, we will be editing the functions.php file, which is an important component of the WordPress theme and allows us to add custom functions and features to the site. This method is recommended by WooCommerce. You don’t need to write code, you just need to copy the code and paste it in the functions.php file. Here’s how to do it: 

In your WordPress dashboard, first go to Appearance > Theme Editor. Then select functions.php file in the right-hand side list of theme files. At the end of the file, paste the following code snippet:

				
					function disable_quantity_change( $return, $product ) {
    return true;
}
add_filter( 'woocommerce_is_sold_individually', 'disable_quantity_change', 10, 2 );

				
			

This code effectively tells WooCommerce to treat all products as “sold individually,” which removes the quantity field from the cart page. Now, the customers can only see the quantity on cart page. Output:

Method 2: Using a Plugin or Extension

Plugins make implementations easier. If you do not prefer to play with code then you can consider this method of using a WooCommerce extension or plugin. There are many special plugins available for removing or editing the quantity field in your WooCommerce store, WPC Product Quantity for WooCommerce is worth checking.

This plugin allows you to fully control the quantity field, you can set min/max quantity to add/purchase items and even define the steps for the selection of items by adding global rules. 

Advanced Product Quantity is another option to try out. It is a WooCommerce extension that provides complete control over the products and cart quantities. You can find complete step-by-step instructions on setting up this extension by WooCommerce here.

How to Disable Quantity Field from Single Product Page?

You can also disable the quantity field for any particular product that you don’t want to sell in bulk or quantity. This can be subscriptions, deals, packages, or any limited-stock item. Here’s how to do it:

First, go to WordPress dashboard > Products and open the product on which you want to hide the quantity change feature. Scroll down till you see the following screen: 

Click on the Inventory tab and checkmark the option of Sold Individually. This will allow customers to purchase a single item at a time by disabling the quantity change feature. 

If you further want to completely remove the quantity field then you can implement the following steps described in the image. Make sure to select Simple Product from te options. 

This will completely remove the quantity field from the product page and display stock available for the item. This is recommended for the limited-stock products, for subscription items you must select the type of subscription product. 

This way you can easily remove the quantity field from a single product page. 

By following the steps outlined in this tutorial, you’ve successfully customized your WooCommerce store to disable quantity changes in the cart page. This modification can lead to a more controlled and efficient shopping experience for both you and your customers.

So, that’s all for this blog. All the methods explained in this blog are personally tested and approved by experts. I hope you will find these helpful. If you are stuck anywhere then SavyCoder is just a text away to help. Approach via contact us.

If you like this article then please subscribe to the newsletter below. 

Stay Ahead with AI & Productivity Insights

Get the latest tools and tips in AI and productivity delivered straight to your inbox. 

Scroll to Top