To hide quantity WooCommerce fields and stop shoppers from changing amounts, use the Sold individually setting or a short code snippet. CSS can hide the box, but my tests showed it never stops a change behind the scenes.
I tested every method on WooCommerce 11.2.0 with WordPress 7.1.3 in October 2026. I used both the Cart block and the classic cart shortcode. I also sent direct Store API requests for a quantity of 5 to see which methods really hold.
This guide covers four separate goals that people mix up. You will learn how to lock the cart quantity, hide the quantity box, hide the stock count and turn off the cart for catalog stores.
What Does It Mean to Hide Quantity in WooCommerce?
Hiding quantity in WooCommerce can mean four different things, and each needs a different fix. You may want to remove the quantity box, lock the amount in the cart, hide the “12 in stock” text or remove buying entirely. Pick your goal first, because the wrong method can look right and still fail.
Here is how the four goals map to fixes:
- Lock the cart quantity: Use Sold individually for one item per order, or a validation snippet for any other rule.
- Remove the quantity box: Sold individually removes it, while CSS only hides it from view.
- Hide the stock count: Change the stock display format in the inventory settings.
- Turn off buying: Make products not purchasable. Some stores call this catalog mode.
The first goal matters most for stores that sell licenses, event seats or limited items. A shopper who changes 1 to 5 can break your stock count or your pricing rules.
WooCommerce now ships two cart pages. The Cart block is the default on new stores. Older stores often still use the [woocommerce_cart] shortcode. A snippet written for one does not always work on the other. So I tested both.
How I Tested Each Method
I added one mug to the cart for each method and then asked the WooCommerce Store API to change its quantity to 5. That request is what the Cart block sends when a shopper clicks the plus button. A method passes only when the store refuses the change.
The results surprised me. Two of the five setups hid or froze the selector on screen and still accepted the quantity of 5 from the API.

Only Sold individually and a validation filter refused the request. With Sold individually, the API answered readonly_quantity with the message “The quantity of Ceramic Mug 1 cannot be changed”. With the filter, it returned my own error message.
So a lock that only changes the display is not a lock. If a rule protects stock or money, it has to run on the server.
Method 1: Use the Sold Individually Setting
Sold individually is the built-in way to disable quantity change in the WooCommerce cart. It limits a product to one item per order and removes the quantity box from the product page and the cart. In my test it was the only no-code method that refused a quantity change.
WooCommerce’s product editor settings guide says the option lets customers buy only one of the item per order. It adds that customers cannot adjust the quantity of the item in their cart.
To turn it on, follow these steps:
- Go to Products > All Products and open the product you want to limit.
- Click the Inventory tab.

- Tick Limit purchases to 1 item per order next to Sold individually.
- Click Update to save the product.
The product page then shows only the Add to cart button and no quantity box.

In the Cart block, the quantity selector disappears too. The shopper sees the product, its price and the trash icon to remove it.

Compare that with the default Cart block, where the selector has minus and plus buttons around the number.

The limit applies to each order and does not last forever. A shopper can place a second order. Use a membership or account rule if each person may buy only once.
Sold individually covers one item per order only. For minimum or maximum caps, limit purchase quantity in WooCommerce with a plugin or code.
Method 2: Lock the Cart Quantity With a Code Snippet
A code snippet locks the quantity at whatever amount the shopper added, even above one. It is the WooCommerce disable quantity change in cart fix for bundles and set amounts. You need two parts, one for the Cart block and one for the classic cart.
Add the code with a snippets plugin or a child theme’s functions.php file. Test it on a staging site first, because a typing error in PHP can take a site offline.
Lock Quantity in the Cart Block
The Cart block reads its limits from the Store API. The snippet uses two Store API filters. The first marks the quantity as not editable. That turns the selector into a plain read-only box. The second, added in WooCommerce 11.2, refuses any request that changes the amount.
add_filter( 'woocommerce_store_api_product_quantity_editable', '__return_false' );
add_filter( 'woocommerce_store_api_cart_item_quantity_validation', function ( $valid, $quantity, $product, $cart_item ) {
if ( (float) $quantity !== (float) $cart_item['quantity'] ) {
return new WP_Error( 'locked_quantity', __( 'The quantity of this item cannot be changed.', 'your-text-domain' ) );
}
return $valid;
}, 10, 4 );
The WooCommerce developer blog announced the new cart validation filter for version 11.2. The filter’s code comment says it runs when an item already in the cart is updated. It does not run when the item is first added.

Do not skip the second filter. In my test, the editable filter alone removed the buttons, yet the API still accepted a quantity of 5. The core check in QuantityLimits.php blocks a read-only item only when the new amount goes above its maximum.
Lock Quantity in the Classic Cart
The classic cart prints its quantity field through a filter. You can replace the field with plain text. That removes the box, but it does not stop a crafted form request. Add a second filter that validates the amount when the shopper clicks Update cart.
add_filter( 'woocommerce_cart_item_quantity', function ( $html, $key, $item ) {
return '<span class="fixed-qty">' . esc_html( $item['quantity'] ) . '</span>';
}, 10, 3 );
add_filter( 'woocommerce_update_cart_validation', function ( $passed, $key, $values, $quantity ) {
if ( (float) $quantity !== (float) $values['quantity'] ) {
wc_add_notice( __( 'The quantity of this item cannot be changed.', 'your-text-domain' ), 'error' );
return false;
}
return $passed;
}, 10, 4 );
I tested the first filter alone by adding a hidden quantity field of 5 to the cart form. WooCommerce accepted it and the cart showed 5. With the second filter added, the cart stayed at 1 and showed the error message.

To apply the lock to some products only, check $product->get_id() or a product category inside each function. Return early for every product that should keep a normal quantity box.
New to filters like these? Our guide on how to create a WooCommerce plugin shows how to package them in a small plugin of your own.
Method 3: Hide the Quantity Field With CSS
CSS hides the quantity field from view, but it changes nothing in how the store works. In my test, the Store API accepted a quantity of 5 while the selector was hidden. Use CSS only to clean up a layout, never to protect stock or pricing.
This rule hides the field on the classic templates and in the Cart block:
.quantity,
.wc-block-components-quantity-selector {
display: none !important;
}
On a block theme, add it under Appearance > Editor > Styles > Additional CSS. On a classic theme, use Appearance > Customize > Additional CSS.
A hidden field also hides useful information. Shoppers can no longer see how many items they added. Show the amount somewhere else if you hide the box.
For stores that sell more than one of an item, a better fix is often a quantity rule instead of a hidden field. WooCommerce tiered pricing and rewards can then encourage larger orders. Our roundup of the best WooCommerce points and rewards plugins shows options that reward repeat buyers.
Method 4: Hide the Stock Quantity
If your goal is to hide the “12 in stock” text, change one inventory setting. Go to WooCommerce > Settings > Products > Inventory and set the stock display format to never show the quantity. The cart and checkout keep working normally.

The dropdown has three choices in WooCommerce 11.2:
- Always show quantity remaining in stock: Shows text such as “12 in stock”.
- Only show quantity remaining in stock when low: Shows text such as “Only 2 left in stock”.
- Never show quantity remaining in stock: Hides the number and keeps the stock status.
The setting appears only when stock management is on. Stock still counts down behind the scenes. Out of stock products still stop selling.
WooCommerce Disable Cart: How to Turn Off Buying
The WooCommerce disable cart setup makes products not purchasable with one filter. The Add to cart button disappears, and WooCommerce removes those products from any cart that already holds them. Stores that only show products and take orders by phone or form use this setup.
add_filter( 'woocommerce_is_purchasable', '__return_false' );
In my test, the product page kept its price and description but lost the Add to cart button. A shopper who already had the mug in the cart saw a notice saying it was removed because it can no longer be purchased.

Tell shoppers how to order instead. A short note under the price and a link to your contact form keep the page useful.
Hide the cart and checkout links in your menu too. Our list of WooCommerce shortcodes helps when you rebuild a classic page without them.
Should You Disable WooCommerce Cart Fragments?
You rarely need to disable WooCommerce cart fragments today. Since WooCommerce 7.8, the cart fragments script loads only when a page needs it. In my test on Twenty Twenty-Five, the wc-cart-fragments script did not load on the home, shop, product, cart or Cart block pages.
The WooCommerce developer blog explains the change in its post on cart fragments best practices. It says the script loads only when the Cart Widget is shown or when other code asks for it.
Cart fragments refresh the mini cart after an item is added on a cached page. If an older theme or plugin still loads the script on every page, you can stop it with wp_dequeue_script( 'wc-cart-fragments' ); on pages without a cart widget. Test the mini cart afterward.
Check the page source before you change anything. Search for wc-cart-fragments, and if it does not appear, there is nothing to disable.
Does This Work With Variable Products?
Yes, the methods work with variable products, with one detail. Sold individually is set on the parent product in the Inventory tab, and it applies to every variation. A shopper can still buy one of each variation, because each variation counts as a separate cart item.
The Store API snippet works for variations too. The $cart_item array carries the variation’s own quantity. The lock applies to each line on its own.
If you need one item per order across all variations, Sold individually is not enough. Count the parent product in the cart with a custom validation rule instead.
Test with two different variations in the cart. That shows quickly whether your rule treats them as one product or two.
Common Mistakes When You Hide Quantity
Most failed setups come from a handful of mistakes. People hide the field with CSS and assume it is locked, test only the classic cart, or forget that caching shows old pages. A quick test with the Store API or a second browser catches all three.
- Trusting CSS: Hidden is not locked as my Store API test showed.
- Testing one cart: Check both the Cart block and the classic cart if your store has used both.
- Skipping the server check: A display filter without a validation filter still accepts crafted requests.
- Old cached pages: Clear your page cache after the change and then test in a private window.
- Theme overrides: A theme with its own cart template can ignore the classic quantity filter.
Edit the cart page itself with care. Our guide on how to edit the WooCommerce cart page explains which hooks run in the Cart block and which run only in the shortcode.
Which Method Should You Use to Hide Quantity WooCommerce Fields?
To hide quantity WooCommerce fields with a real lock, use Sold individually when each order should hold one item. Use the snippet when the amount must stay at another number. Use CSS only for looks, and use the stock setting to hide only the stock count.

A larger store often combines two methods. A license shop might use Sold individually on software and hide the stock count on every product.
If your rules are more complex, such as different limits per customer role, a small custom plugin is safer than many snippets. Our custom WooCommerce plugin development team can build and test one for your store.
Conclusion
You can hide quantity WooCommerce fields in four ways, and only two of them lock the amount. Sold individually and a validation snippet both refused a quantity change in my Store API test.
CSS and the editable filter alone changed only the screen. A crafted request still set the quantity to 5. Never rely on them for stock or pricing.
Pick the goal first and then the method. Test the Cart block and the classic cart, and clear your cache before you call it done.
Frequently Asked Questions (FAQs)
Q1. How do I hide the quantity field in WooCommerce without code?
Open the product, click the Inventory tab and tick Limit purchases to 1 item per order. The quantity box disappears from the product page and the cart. This works per product and limits each order to one item.
Q2. How do I disable quantity change in the WooCommerce cart?
For one item per order, use Sold individually. For any other amount, add the two Store API filters for the Cart block and the two cart filters for the classic cart. Then test both pages.
Q3. Does hiding the quantity with CSS stop customers from changing it?
No. CSS only hides the field from view. In my test, the Store API still accepted a quantity of 5 with the field hidden.
Q4. Can customers still buy more by adding the product twice?
No, with either lock in place. In my test, a second add to cart for the same mug returned an error with Sold individually and with the validation snippet. The cart stayed at one item both times.
Q5. How do I hide the “in stock” number on product pages?
Go to WooCommerce > Settings > Products > Inventory. Set the stock display format to Never show quantity remaining in stock. Stock still counts down, and the stock status text stays visible.
Q6. How do I undo these changes?
Untick Sold individually on the product, or remove the snippet and the CSS rule. Clear your page cache afterward. The quantity selector returns in the cart on the next page load.
