The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Remove WooCommerce Product Quantity from the Cart

Shared by Amit Dholiya · September 7, 2026 · @woocommerce_cart_item_quantity

18 views
1 upvote
Back to Snippets

If you want customers to purchase only one quantity of each product, you can remove the quantity field from the WooCommerce Cart page.

Steps

  1. Open your theme’s functions.php file.
  2. Add the code below.
  3. Save the file.
  4. Refresh your Cart page.

Done — the quantity input will be hidden from the cart.

function hide_cart_quantity_field( $product_quantity, $cart_item_key, $cart_item ) {

    return '<span class="cart-quantity">1</span>';
}

add_filter(
    'woocommerce_cart_item_quantity',
    'hide_cart_quantity_field',
    10,
    3
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments