4 Easiest Ways to Remove Quantity WooCommerce Field

WordPress is the most popular content management system (CMS), and most users prefer WordPress because it works well with many e-commerce plugins, such as WooCommerce.

By default, WooCommerce adds a quantity field next to each product, allowing customers to specify how many units they want to buy. This field can appear as a text box for manual entry or a dropdown menu with quantity options.

Reasons for removing the WooCommerce quantity field

You might want to remove the quantity field if you’re:

  • Selling services (like digital commissions) where quantity doesn’t apply
  • Selling limited products with a maximum of 1 per customer
  • Operating a store where quantity selection isn’t relevant

How to remove the WooCommerce quantity field

1. Use a specialized plugin

Plugins like Advanced Product Quantity and WPC Product Quantity for WooCommerce provide enhanced control over quantity fields and can be configured to remove them entirely.

2. Use a hook with Code Snippets

Install the Code Snippets plugin and add this code to remove quantity fields from all products:

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

This method removes quantity fields site-wide but isn’t suitable if you only want to remove them from specific products.

3. Use the product data metabox

For individual products:

  1. Go to your WordPress admin area and navigate to WooCommerce products
  2. Click on the product you want to modify
  3. Scroll to the Product data metabox
  4. Select “Inventory” from the side menu
  5. Check the “Sold Individually” checkbox

This method works well for stores with few products but becomes tedious for larger inventories.

4. Apply custom code

Important: Back up your website before editing core files.

Hide quantity field for specific product types: Add this code to your functions.php file:

add_filter( 'woocommerce_is_sold_individually', 'cw_remove_quantity_fields');
function cw_remove_quantity_fields( $return, $product ) {
    switch ( $product->product_type ) {
        case "grouped":
            return true;
            break;
        case "external":
            return true;
            break;
        case "variable":
            return true;
            break;
        default:
            return true;
            break;
    }
}

Hide quantity field for all products: Add this code to your functions.php file:

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

Choose the method that best fits your store’s needs and technical comfort level. Similar to WordPress, the WooCommerce plugin is favored by sellers and businesses for its flexibility. You can change just about any element in the theme. As we’ve shown, it only takes a few minutes to remove the WooCommerce quantity field.