Issue with Theme’s Quick Add Feature Allowing Excess Quantities

Topic summary

Main issue: The Trade theme’s Quick Add/Choose Options lets shoppers input quantities beyond actual stock, despite “track quantity” enabled and “continue selling when out of stock” disabled. Example: product variants have only 5 units each.

Key clarification: Cart additions don’t reserve inventory; availability is enforced at checkout. This explains why carts can temporarily show higher quantities even when stock is limited.

Proposed fix (UI constraint): Add an HTML max attribute to the quantity input so customers can’t select more than available stock. Suggested logic (from Dawn’s quantity-input.liquid):

  • If variant.quantity_rule.max exists, use it for max.
  • Else, if inventory_management is ‘shopify’ and inventory_policy is ‘deny’, set max to variant.inventory_quantity.

Outcome: The original poster confirmed this solution addressed their need. No further issues or open questions noted. The attached screenshot is not essential for understanding the fix; the code change is the key action item.

Summarized with AI on December 14. AI used: gpt-5.

Hi,

I need help fixing a bug in a theme called Trade. In the theme’s choose options/ quick add feature (as shown in the screenshot below), customers can add any quantity they want, regardless of the actual stock available.
I’ve enable to the “track quantity” option and disabled the “continue selling when out of stock” option on the product listing, however customers are still able to add quantities exceeding the current inventory.

This is a known issue with the theme but I was unable to find any fix for this.

Link: https://testingstoresandthemes.myshopify.com/collections/shakers
Storefront password: 12345

any help is greatly appreciated.

PS: The actual inventory available in this product is 5 pieces in each color

@technase you’ll have to modify the quantity input and add a “max” attribute that contains the available amount of the product.

Depending on how the variant is retrieved in the code, it should look like this:

 ...>

It’s not an issue. Adding items to cart does not reserve them, so it may happen that you’ve added 10 out of 15, but somebody else also bought 10, so your cart quantity becomes invalid. And other way around.

Only when you reach checkout the cart amount gets actually reserved and this is when system will tell whether it is available.

But you can change this code https://github.com/Shopify/dawn/blob/main/snippets/quantity-input.liquid#L30-L32

to this:

{% if variant.quantity_rule.max != null %}
      max="{{ variant.quantity_rule.max }}"
    {%  elsif variant.inventory_management == 'shopify' and variant.inventory_policy == 'deny' %}
      max="{{ variant.inventory_quantity }}"
    {% endif %}
1 Like

exactly what I was looking for. Thanks heaps!