Black Friday Discount 50% Off · Use Code BF2020 at Checkout

How to Remove the WooCommerce Quantity Field

Quantity Field on a WooCommerce Product
An example of a Quantity Field on a WooCommerce Product

WooCommerce includes a quantity input field on products by default. This input shows up on both the individual product page as well as the cart review screen. This simple feature, especially on the cart view, seems like a wonderful addition to make the user experience better but sometimes it has unintended consequences.

If you never want your customers to be able to order more than one of any given product for sale on your site you are going to want to disable the quantity field from your WooCommerce theme.

There are several ways to do this and they range from tedious to quick and easy.

How to Hide the Quantity Field on WooCommerce Products

There’s an option inside of WooCommerce’s product management interface to mark an item as only eligibigle for individual sale. You can find this by opening up your product inside of the WooCommerce admin and scrolling down to the “Product Data” section of the interface.

Under “Product Data” you will see a series of tabs on the left-hand side. The option you are looking for is available under the “Inventory” tab. At the bottom of that tab is a checkbox called “Sold Individually” that will disable the quantity field for this particular product (and only this product).

WooCommerce Product Marked as "Sold Individually"
A WooCommerce Product Marked as “Sold Individually”

Checking that box and saving your product will remove the quantity field from the product’s page and it’s row in the cart view when a customer is going to checkout. When a product is marked as “Sold Individually” it also has the added bonus of preventing customers from adding more than one item to your cart by disabling the “Add to Cart” process if one of the item has already been added.

Remove the Quantity Field from All WooCommerce Products by Editing Your Theme

Let’s write some code. You can disable quantity fields throughout your store’s site with a bit of theme editing. First, we’re going to walk through the steps on how you can do this safely. Then we’ll show you the actual code and where to put it.

Alert! Please make a backup of your current WordPress installation before attempting any of the following steps. Make sure you have working backups of your site’s database as well as it’s theme files. If things go wrong you will need to revert back to those prior versions.

Make a Child Theme

No one should edit a WordPress theme directly. Any changes you make to a theme’s files will be automatically overwritten during future updates. The best way to adjust your WooCommerce store’s look is through a child theme. You can read more about child themes, and how to create one correctly, at the official WordPress site.

The basic idea is that the child theme loads up the parent theme, applies your changes, and then displays the site to your visitors. Any updates you download for the parent theme will not change the child theme files. In theory, that means your changes to the site layout will still maintain through the update process.

Add Code to the Child Theme

WordPress themes have a file called functions.php where you can add code snippets. Create that file inside your child theme’s directory and then open it up in a text editor. Add the following lines of code to the file:

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

After you’ve added those lines of code save the functions.php file. You’re ready for the next step which is uploading your child theme to your server.

Upload the Child Theme

This is probably the most technical part of the process. Yes, even more so then building a child theme and writing code in a text editor. You need to take your new child theme and upload it to your site’s web host. There are dozens of free FTP programs you can use to do this. Your hosting provider’s technical support staff might be able to help as well.

Has this gotten a bit too technical for you? You can remove quantity fields from your WooCommerce site without all of this nonsense. Avoid the mess of editing themes and uploading files completely. Jump ahead in this article to learn how our Remove WooCommerce Features plugin can help.

Active the Child Theme

We are almost finished. When you have successfully uploaded your child theme it should appear under Appearance in the WordPress admin. If you don’t see it there then check the upload again. You might have missed a file or done something incorrectly.

Your quantity fields should be gone from the store as soon as you activate the child theme. If they are still there or, even worse, your site is broken with errors you need to go back and find the problem in your code. This is the point where you might need to find a knowledgeable WordPress developer to help.

Assuming all has gone well then it’s time to congratulate you on being a successful WordPress theme developer. These kinds of projects aren’t for everyone. There is a simpler, and less time intensive way, to deal with this WooCommerce change.

Disable the Quantity Field from Your WooCommerce Store in Seconds

Our plugin, Remove WooCommerce Features, has a built-in control for removing the quantity field and it doesn’t require you having to write code or edit key files inside of your theme.

After purchasing and installing Remove WooCommerce Features the process of disabling quantity fields is simple. You can do it all in a few steps.

Step #1

Go to the WooCommerce section of your WordPress installation’s admin menu and click the link that says Remove Features.

WooCommerce Admin Menu

Step #2

Find the setting for Quantity Field and click the checkbox so that it’s marked like so:

Remove WooCommerce Features - Quantity Field

Step #3

Press the button.

And you’re done. As soon as you pressed the “Save Settings” button the plugin removed the quantity fields throughout your site. The change is immediate.

Quantity Field Removed from WooCommerce Product
An example of a Quantity Field Removed from WooCommerce Product

The best part is you can change themes, or WordPress developers, or web design agencies, and as long as our plugin is installed and active the quantity fields will remain gone.

Remove WooCommerce Features, the plugin with the most literal name around, does a lot more than just handle quantity fields.

With the plugin you can disable dozens of features from your site including:

Remove WooCommerce Features Logo