On this page
What this issue is
The quantity selector is the number box (or plus and minus buttons) next to Add to cart. This issue means a shopper can type 0, -1 or an empty value and the site accepts it instead of correcting it or showing a clear message.
Two layers can fail. The front end (the HTML input) may have no min attribute, or custom buttons may let the number drop below 1. The back end (the cart or order code) may not reject the value if someone edits it or sends it directly. Fixing only the first layer leaves a gap.
Why it costs you leads or sales
Impact is usually low, because most shoppers never type a zero. But when it happens the results are confusing: an empty cart after clicking Add to cart, a cart line with a negative price, a total lower than expected, or an error page at checkout. A shopper who hits any of these often leaves.
The bigger risk is on stores that do not validate on the server. A negative line can reduce an order total, which is a revenue and stock-accuracy problem rather than only a usability one.
- Product pageShopper opens the product
- Quantity entered0 or -1 is accepted
- CartEmpty cart, odd total or error
- CheckoutNever reached or wrong amount
A quantity of 0 or -1 is accepted on the product page and causes trouble in the cart.
A bad quantity leads to an error or empty cart instead of a helpful correction.
How to check if your site has it
Open a product page in a private window
Use a product that is in stock so stock errors do not hide the result.
Type 0 and click Add to cart
Good result: the field resets to 1 or shows a clear message. Bad result: an empty cart, a zero-quantity line or an error.
Type -1 and repeat
Also try a blank field, a decimal such as 1.5, and a very large number such as 99999.
Press the minus button repeatedly
If your theme has plus and minus buttons, check they stop at 1.
Repeat in the cart
Change the quantity on the cart page too. It is a separate field and often has different rules.
Inspect the input
Right-click the field, choose Inspect, and look for min="1" on the input element.
How to fix it
Fix both layers: set a minimum on the input, then make sure the server rejects or corrects anything below 1. The exact place depends on your platform and theme.
Edit the theme's quantity input
Go to Online Store > Themes > Edit code. Find the quantity input (often in a product form or quantity snippet) and make sure it has min="1". Themes differ, so search for name="quantity".
Check the cart
Do the same in the cart template or section. Shopify's cart rejects negative values on its side, but your theme should still show a clear message.
Use WooCommerce's built-in minimum
WooCommerce product inputs normally set min to 1. If yours does not, a theme override or plugin is likely changing the template. Check yourtheme/woocommerce/global/quantity-input.php.
Filter the arguments if needed
Add the woocommerce_quantity_input_args filter (code below) to a child theme or code snippets plugin.
Set the minimum on the field
In Webflow Ecommerce, the Add to Cart quantity input is a form field. Select it, open Settings, and set the minimum to 1 if the option is shown. Test after publishing.
Use the built-in selector
The Wix Stores quantity selector starts at 1 and is controlled by Wix. If you added a custom field with Velo, set its minimum to 1 and validate in code.
Test the default selector
Squarespace product pages use their own quantity control. If you injected custom code, remove or correct it, and test 0 and -1 after saving.
Add min and step to the input
Use the HTML below.
Validate on the server
Cast the value to an integer and reject anything below 1 before it reaches the cart (example below).
<input type="number" name="quantity" value="1" min="1" step="1" inputmode="numeric">add_filter( 'woocommerce_quantity_input_args', function ( $args ) {
$args['min_value'] = 1;
$args['step'] = 1;
return $args;
} );function parseQuantity(input) {
const qty = Number.parseInt(input, 10);
if (!Number.isInteger(qty) || qty < 1) {
throw new Error('Quantity must be a whole number of 1 or more');
}
return qty;
}How to confirm it's fixed
- Typing 0 resets to 1 or shows a clear message
- Typing -1 is rejected or corrected
- A blank field does not create an empty cart line
- Minus buttons stop at 1
- Decimals such as 1.5 are rejected or rounded
- The cart page quantity field follows the same rules
- A normal order with quantity 2 still reaches checkout
Before
- 0 or -1 accepted
- Empty cart or odd total
- No message shown
After
- Minimum of 1 enforced
- Server rejects bad values
- Clear message if the number is invalid
How to prevent it happening again
This problem usually returns after a theme update, a new theme or a plugin that replaces the quantity box. Keep custom quantity code in a child theme or a documented snippet, so updates do not overwrite it.
- Add the 0, -1 and blank test to your release checklist
- Retest after theme, page-builder or cart plugin updates
- Validate quantity on the server for any custom cart code
- Test on mobile, where plus and minus buttons are common
How FunnelGuard handles this
FunnelGuard does not check this yet. Entering 0 or a negative quantity is a negative-path test, and it is a possible future check rather than something the service runs today.
What FunnelGuard does run nearby is the normal journey: a robot visitor opens the product page, adds the item to the cart and moves through the steps, on a schedule from the EU or the US. If a theme change breaks Add to cart or the cart step, that check can show it, with a screenshot and a likely cause. It will not tell you whether 0 or -1 is accepted.
The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.
Questions people ask
Why does my quantity field accept 0 or negative numbers?
The input most likely has no min attribute, or a custom theme script lets the value drop below 1. If the server also skips validation, the bad value passes through to the cart. Add min="1" and validate on the server.
How do I set a minimum quantity of 1 on my product page?
Add min="1" step="1" to the quantity input. On WooCommerce, use the woocommerce_quantity_input_args filter. On Shopify, edit the theme's quantity input in Online Store > Themes > Edit code.
Can a negative quantity lower the order total?
On a store with no server-side validation, it can, because a negative line subtracts from the total. Major platforms usually reject it, but custom carts and some plugins may not. Always validate on the server.
Is the HTML min attribute enough to block bad quantities?
No. The min attribute only guides the browser, and it can be edited or bypassed. Your cart or order code must also reject values below 1.
What should happen when someone enters 0 as the quantity?
The field should reset to 1 or show a short message asking for a quantity of at least 1. Some stores treat 0 in the cart as removing the item, which is fine if it is clear to the shopper.
Does FunnelGuard detect a quantity selector that accepts 0 or negative?
No. FunnelGuard does not check this yet, though it is a possible future check. It does run the normal add-to-cart journey on a schedule, so you can test the bad values yourself after changes.
How do I test quantity validation quickly?
Open a product page in a private window and type 0, -1, a blank value and 1.5 into the quantity field, then click Add to cart. Repeat on the cart page, and check you get a correction or message each time.