How to Remove Quantity Field from WooCommerce Product Page: 2 Easy Ways

WooCommerce, by default, includes a quantity selector on product pages, allowing customers to choose how many units they want to purchase. However, in many cases, store owners might prefer to remove quantity field to ensure customers can only buy one item per transaction or simply to streamline the checkout process. Whether you’re running a digital products store, selling limited-edition items, or enforcing purchase restrictions, removing the quantity selector can enhance your store’s user experience.

In this guide, we will explore multiple methods to remove the quantity field from WooCommerce product pages using both built-in WooCommerce settings and custom coding.

8 Best WordPress eCommerce Plugins

Why Remove Quantity Field in WooCommerce?

There are several reasons why store owners may want to remove quantity field from their WooCommerce product pages:

  1. Single Purchase Restrictions: If you want to limit the purchase of certain products to only one per order, removing the quantity field ensures customers do not add multiple units.
  2. Better Checkout Experience: A simplified checkout process reduces customer confusion and may increase conversion rates.
  3. Avoid Inventory Issues: For stores with limited stock, enforcing a single-purchase rule can help distribute products more fairly.
  4. Digital or Subscription-Based Products: Some products, like digital downloads or service-based offerings, don’t require a quantity selector.

Now, let’s look at the different methods you can use to remove the quantity field in WooCommerce.

Method 1: Use WooCommerce’s Built-in ‘Sold Individually’ Feature

WooCommerce includes a built-in feature that allows you to mark products as ‘Sold Individually,’ which automatically removes the quantity selector.

Steps to Remove Quantity Field via WooCommerce Settings

  1. Access the Product in WordPress:
    • Log in to your WordPress admin panel.
    • Navigate to Products and select the product you want to edit.
  2. Modify Inventory Settings:
    • Within the Product Data section, click on the Inventory tab.
    • Locate the Sold individually checkbox.
    • Check the option labeled “Enable this to only allow one of this item to be bought in a single order.”
  3. Save Your Changes:
    • Click the Update button to apply the changes.

This method is useful for selectively removing quantity field for specific products without affecting the entire store.

Method 2: Remove Quantity Field Using a Code Snippet

If you want to remove quantity field from all products globally, you can do so by adding a simple code snippet to your theme’s functions.php file.

Steps to Remove Quantity Field via Code:

Access the Theme Editor:

  • Log in to your WordPress admin panel.
  • Navigate to Appearance > Theme Editor.
  • Open the functions.php file of your active theme.

Insert the Custom Code:

  • Scroll to the bottom of the functions.php file and add the following code:
function custom_remove_all_quantity_fields( $return, $product ) {return true;}
add_filter( 'woocommerce_is_sold_individually','custom_remove_all_quantity_fields', 10, 2 );

Save Your Changes:

  • Click the Update File button to apply the modifications.

This code applies the WooCommerce filter woocommerce_is_sold_individually, which sets all products as ‘sold individually’ and removes the quantity field from all product pages.

Remove Quantity Field via a Plugin

There are several WooCommerce plugins that allow you to remove the quantity field without editing code. Some popular plugins include:

  • WooCommerce Advanced Product Quantities
  • Product Quantity Control for WooCommerce
  • WooCommerce Customizer

These plugins provide an easy, user-friendly way to customize quantity settings in WooCommerce.

Important Considerations When Removing the Quantity Field

Before implementing any method to remove the quantity field, keep these points in mind:

  1. Test Before Going Live:
    • After making changes, thoroughly test the checkout process to ensure everything functions correctly.
    • Try different products, add them to the cart, and go through the checkout flow to confirm there are no unexpected issues.
    • If possible, ask someone else to test it as well to catch any potential problems you might have missed.
  2. Use a Child Theme:
    • If you are modifying the functions.php file, it is highly recommended to use a child theme.
    • A child theme ensures that your modifications remain intact even after updating your WooCommerce theme.
    • Without a child theme, updates to your main theme might overwrite your custom code, forcing you to reapply the changes.
  3. Backup Your Site:
    • Before making any modifications, always create a full backup of your website.
    • This includes backing up your database, theme files, and plugins to avoid any potential data loss.
    • Using a backup plugin or your hosting provider’s backup feature can save you from unexpected technical issues.

Conclusion

Removing the quantity field in WooCommerce can improve your store’s shopping experience, prevent over-purchasing, and simplify the checkout process. Whether you use WooCommerce’s built-in ‘Sold Individually’ feature, add a simple PHP snippet, apply CSS, or use a plugin, each method has its advantages.

By implementing one of these methods, you can successfully remove quantity field from WooCommerce product pages and customize your store according to your needs.

Deals & Discount

Coupons

Unbounce Coupon

Save 35% off your first year

Cloudways Coupon

Save 20% off first 1 months

Featured

WordPress Plugins

PatternsWP

WordPress Block Patterns Library

ClonePress

Duplicate Pages, Posts & CPT