I just need a fix to edit the liquid code for the various product variations that allows us to limit it to 1 or 2 TOTAL per customer, no matter which variants/option they pick.
Can we limit it at the global product level instead of having to go into the individual options?
Can we display text that says, limit x per customer?
Limit Quantity, Limit Total, Limited Edition
I want to hard code this and don’t want to mess with a monthly app with more features.
you can do this by using some liquid code and jquery code.
when customer change the value match the value with maximum one if its low or equal to the maximum one add cart button will work otherwise not working.
If you are still looking for a solution to this you can try using the Checkout Guardian app, wherein you can restrict the user to a maximum number of purchase and if added more he wont be able to checkout. You can display a customised message to the client saying you can order only 2 products from the store and further restrict them from future purchase also.
Let me know if you find this app suitable as per your requirment.
Yes — you can limit the total quantity per product, even across variants, without touching Liquid or writing custom scripts.
I had the same issue with some limited-run items, and the manual code approach kept breaking (especially with AJAX carts and variant changes). What ended up working reliably for me was using a small checkout-validation tool that lets you set per-product or per-variant limits, like:
Max 1 per customer
Max 2 per product (all variants combined)
Min/Max order quantity rules
Custom error messages at checkout
It took less than a minute to set up, and it applies across the cart, product page, and checkout.
It lets you build simple rules like “limit 2 per product” or “limit 1 per customer,” and shows a clean validation message before checkout. No theme editing, no custom code.
You are able to add a per customer limit by using a simple script that checks the cart contents in your theme’s code: it counts the total quantity of a product (across variants). If limit is exceeded, prevent checkout and display your message. For clarity for customers, add a static note on the product template.
I see you’d like to limit the maximum quantity a customer can purchase for a product — for example, allowing only 1 or 2 units regardless of the variant selected. This can be achieved using Easify Product Options.
Here’s an example I’ve created so you can see how it works:
To control how many items customers can select, go to the Advanced settings of your option and adjust the limits under Limit quantity input. There, you can set a Min quantity and Max quantity, or require customers to select an exact total quantity using the Set an Exact Total quantity for all selected items feature.
This allows you to control quantities per customer without manually adjusting Liquid, while still ensuring a smooth, accurate shopping experience.
It’s incredibly easy to use and performs perfectly when it comes to product personalization. Easify’s support team is just a message away if you ever have questions.
I saw your question about limiting the total quantity across variants of the same product. Shopify tracks purchases per variant, so a combined cap needs a customer-level rule.
In DC Order Limits, use Customer Purchase Limits and apply it at the product level so the limit counts across all variants of that product.
Setup:
Create a new Customer Purchase Limit rule
Set the max quantity, for example, 1 or 2
Select the product; the limit applies across its variants
Save and activate
After it is active, the customer’s total across variants is tracked, and additional units are blocked at checkout once the cap is reached.
Hello @JosephAMichael
I understand that you’re looking for a hard-coded solution to limit the total quantity per customer for a product, and I appreciate that you’re trying to avoid using third-party apps with monthly fees.
However, while you can technically implement such a limitation through code, it can require complex customizations to your Shopify theme. This would involve checking the cart, restricting quantities based on your rules, and displaying warning messages — and it can be a bit tricky to maintain as your store evolves.
That said, I’d like to suggest trying out the MultiVariants-Bulk Order app. You can use this app to restrict the minimum order quantity for a particular product. Every time a customer tries to buy the product, they must meet the restrictions. The checkout button won’t work, and a warning message will appear on the product page if the quantity restriction isn’t met. This solution is much easier to set up and maintain compared to hard-coding, and it saves you time. You can check out this demo product for a better understanding.
Plus, the app offers a 5-day free trial, so you can explore the features and see if it fits your needs before committing. Feel free to give it a try, and let me know if you’d like any help with the setup!
Thank you.