Hello, @LitExtension
Can you please help me with Dawn theme?
Thank you!
Limiting product quantity to available stock in the Impulse theme. Goal: set the quantity selector’s maximum to the selected variant’s inventory.
Initial approach: add an HTML max attribute bound to inventory in quantity-input.liquid for single-variant products. For multi-variant products, JS changes are required to enforce the limit.
Proposed JS edits in theme.min.js: read max from the input and clamp quantity changes. Early edits caused issues (images not loading, quantity stuck at 1); corrected code snippets were provided, but the limit still didn’t apply consistently.
Next steps offered: remote debugging and rewriting, noting the quantity function is used in multiple places. The store decided to handle the work in-house.
Alternative solutions: apps suggested to manage purchase limits globally (Purchase Limit, Limit Sales Per Day, Limit Quantity Purchase), including features for min/max per product and collections.
Latest update: a practical fix shared—insert max=“{{ product.selected_or_first_available_variant.inventory_quantity }}” in main-product.liquid around line ~284. A screenshot was provided and is central to implementation.
Status: partially resolved via Liquid for max setting; robust multi-variant JS enforcement may still require further development.