How to Limit Quantity per Item in Cart

2 0 1

I'm looking for guidance on how to set a maximum quantity limit per item in the cart for my store. Specifically, I want to restrict customers from adding more than 3 quantities of a single item to their cart. If, for instance, a customer already has 3 quantities of an item in the cart and they try to add more, I'd like to have an alert to inform them that the maximum quantity has been reached for that particular item. 

I appreciate any insights or code snippets that can help me achieve this functionality on my Shopify store. Thank you in advance for your assistance!

Replies 2 (2)

Shopify Partner
2987 588 833

Hello @christine_27_27 ,


You need to apply the  logic on PDP page.
First step, you need to check the quantity selection on click of the atc button. If it's greater than 3 you have to restrict the default functionality of the atc button and show a message that you can't add more than 3.  
Second step, if customer quantity selection is just 1 and they use same process to add more than 3 items then in this case you have read the cart on every click of the atc button through ajax and If same product counts is greater than 3 show the message and restrict the customer to add product to cart.

Third step, in the cart page make a check on the quantity selector so the customer cannot increase quantity more then 3.  

btw just want to let you know it's not possible to provide code snippets for it because it needs changes in multiple files and a/to the theme you are using.



- If helpful then please Like and Accept Solution.
- Want to modify or custom changes or bug fix on store Hire me.
- Email: - Skype: navrocks1 ,
- Try GEMPAGES a great page builder
-Advance Search Filter
2 0 1

Thanks, I will try these steps