Quantity selector based on available inventory

Topic summary

A user seeks to limit the product quantity selector to match available inventory levels. Currently, customers can select unlimited quantities and only receive an error after attempting to add items to cart.

Desired behavior:

  • The ‘+’ button should become disabled or greyed out when maximum inventory is reached
  • This would prevent the current error message that appears post-cart addition

Proposed solution:

  • Modify Liquid code to output available inventory data for each product
  • Add JavaScript to limit the quantity selector based on inventory
  • Update the ‘Add to Cart’ button behavior using AJAX

The user notes this seems like a basic issue that should have been addressed by Shopify, and mentions seeing many discussions on this topic without clear solutions. The site uses the Dawn theme.

Summarized with AI on November 15. AI used: claude-sonnet-4-5-20250929.

I want to restrict the quantity selector to the amount of inventory available, currently it makes you add unlimited quantity of the products and gives an error line after clicking add to cart. I want the + sign to disable/greyed out one the max inventory quantity is reached.

I have seen many discussions on this but no one have seemed to solve the issue which I think is a very basic issue which should have been solved by Shopify till now.

Site Url: https://filodorobiancheria.it/

Theme: Dawn

1 Like

Hi,

First, you need to modify your Liquid code to output the available inventory for each product in your storefront.

Add JavaScript to Limit Quantity Selector

Update Add to Cart Button Behavior using AJAX API