How to remove the quantity field from the WooCommerce single product page

WooCommerce remove quantity field

By default, WooCommerce product pages will include a number field next to the add to cart button on product pages. The user can update the value in this field to define the quantity of items they want to order. However, for some types of product, you might want to remove this quantity field setting from the single product page. It’s surprisingly simple to do.

WooCommerce quantity field

In this article, we’ll look at three ways to remove the quantity setting from the single product page in WooCommerce. Which method you use will depend on your precise requirements.

What is the WooCommerce quantity field?

The quantity field on a single product page is normally a number input field. (Take a look at this article if you want to change the quantity field to a dropdown field).The user can increase or decrease the quantity of product they want before adding it to the cart.

Almost always, the quantity field is positioned next to the add to cart button but some themes or page builders may place it elsewhere.

Why remove the quantity field from the product page?

There are a few reasons you might want to remove the WooCommerce quantity field.

  • You have low stock and you want to ensure as many customers as possible can purchase the product
  • Users can only purchase the item once – for example, the product is for a service
  • The product is a limited edition and only one per customer is permitted

Option #1: Remove quantity field using standard WooCommerce setting

The easiest way to remove the quantity field from a single product page in WooCommerce is:

  • Click the ‘Inventory’ tab in the ‘Product data’ section
  • Enable the ‘Sold individually’ option
WooCommerce 'Sold individually' setting

Once you save the product, the quantity field will disappear from the product page. This setting is specifically intended to limit purchases of the product to 1 per order – meaning that no quantity field is necessary.

WooCommerce product with quantity field removed

Remove quantity field from cart page

Using this method will also remove the quantity field from the WooCommerce cart page. So the user can’t increase the quantity to more than one from the cart page.

WooCommerce cart line item with no quantity field

That’s the easiest method to remove the quantity field. Let’s look at a couple of alternatives.

Option #2: Remove the quantity field using a filter

You can easily remove the quantity field from the product page programmatically using a filter. This requires a little bit of developer knowledge so, in most cases, it’s easier just to use the setting above. However, if you have multiple products where you want to limit the quantity purchasable to 1, then it might save some time to do it through code.

The code snippet below allows you to remove the quantity field from multiple products without the need to edit each product’s settings individually. Just update the list of product IDs with the product IDs from your own site.

<?php
/**
* Remove quantity field from single product pages for specific products
* Update list of product IDs
*/
function pr_is_sold_individually_product_list( $individually, $product ) {
if( in_array( $product->getid(), array( 1234, 5678 ) ) ) { // Update the IDs in this list
$individually = true;
}
return $individually;
}
add_filter( 'woocommerce_is_sold_individually', 'pr_is_sold_individually_product_list', 10, 2 );

Even simpler, you can use this snippet to remove the quantity field from all your single product pages:

<?php
/**
* Remove quantity field from all single product pages
*/
function pr_is_sold_individually_all_products( $individually, $product ) {
return $individually;
}
add_filter( 'woocommerce_is_sold_individually', 'pr_is_sold_individually_all_products', 10, 2 );

Take a look here at how to add a snippet to your WordPress site.

Removing the quantity field using a filter is quicker than editing each product page individually and if you have several products to edit, it could save you significant time.

This method will also remove the quantity field from the cart page.

Option #3: Use WooCommerce Product Add-Ons Ultimate

Finally, you can use the WooCommerce Product Add-Ons Ultimate plugin to remove the quantity field from the product page. At first sight, it might seem unnecessary to use a premium plugin to achieve the same result as a standard WooCommerce setting but there are some reasons why you might need to adopt this method:

  • If your product is customizable and you want the user to be able to purchase different versions of it, then using Add-Ons Ultimate will allow you to do this. The standard WooCommerce setting above will prevent the product from being added to the cart more than once
  • If your product requires a quantity setting but you don’t need to track inventory – for example, products that are manufactured on demand, e.g. business cards and other printed items, where the user must specify how many they want. This might be used in conjunction with a pricing formula calculation based on quantity

To use Product Add-Ons Ultimate to remove the quantity field from the single product page:

  • Click on the “Product Add-Ons’ tab in the ‘Product data’ section
  • Enable the ‘Hide quantity’ setting
WooCommerce Product Acc-Ons Ultimate 'Hide quantity' setting

The default WooCommerce quantity field will be removed from the product page – but you can add your own quantity fields using add-on fields. For instance, this product uses an add-on field for the user to select quantity, which is then used in the overall price calculation. It makes sense to hide the standard WooCommerce quantity field on this page – but the user can still add the product to the cart more than once.

WooCommerce remove quantity field from product page – recap

So that’s three simple methods to remove the quantity field from your product pages:

  • Use the standard WooCommerce setting to avoid using code
  • Use code if you have multiple products where you want to remove the quantity field
  • Use Product Add-Ons Ultimate if you want to still allow the user to add multiple configurations of the same product to the cart
WooCommerce Product Add-Ons Ultimate featured image

WooCommerce Product Add-Ons Ultimate

Personalize products with extra custom fields and options

Find Out More

Leave a Reply

Your email address will not be published. All fields are required.