I am trying to set a minimum quantity to a specific product that we offer. All other products are still fine at 1, but a particular product type needs to be a minimum of 4. How would I change this to start the order at 4 but allow the customer to change the quantity to anything equal to or higher?
I’ve looked through other similar requests and have looked around the product-template.liquid code but I don’t think that’s what I want since it seems to change the minimum of everything instead of a single product.
Further note, this product changes every few months for a new promotion and art, so it would be exceptionally useful if I could somehow tie this minimum restriction to a given tag. So any time I add the tag MIN4, it applies the minimum 4 rule.
@bcomst this is possible with a little custom coding.
Here’s how I would approach it:
Add the MIN4 tag to the products you want minimum
In the product form file (product-form.liquid, or product.liquid, etc whatever has the quantity / add to cart button), create a script that runs if that tag is present, something like this:
This product requires a quantity of 4 minimum.
{% if product.tags contains "MIN4" %}
{% endif %}
If you’re showing an error message, you could also add some code to clear the message when quantity of 4 is selected (set an event listener on the quantity box).
The exact code will depend on your product page setup, but that code above will help you get started, experiment with that and swap out what you need.
If you prefer to have a professional developer handle it for you, feel free to reach out to my team at speedboostr.com/contact - our developers work on Shopify sites every day to do customizations like this.
You could consider using third-party apps such as Order Limits ‑ MinMaxify. They help you define minimum and maximum product and cart limits for your orders, from simple to complex.
I’d also suggest taking a look at the app OrderLogic by Oiizes. With this app, you can set limits on how few or how many of each product your customers can order. If there is anything else I can help you with, please let me know.
If there is anything else I can help you with, please let me know.
Hi, do you know if it is possible to exclude MOQ from certain customers? I am looking or something similar on our store. We sell salon supplies but also have our own salons, which they order their stock off our store at special wholesale prices through another app as a tagged customer.
For a particular product, we want general customers to purchase MOQ of 5, but for our salons, they have no minimum order requirements. Is this possible with this app?
Hi Dirk, do you know if it is possible to exclude MOQ from certain customers? I am looking or something similar on our store. We sell salon supplies but also have our own salons, which they order their stock off our store at special wholesale prices through another app as a tagged customer.
For a particular product, we want general customers to purchase MOQ of 5, but for our salons, they have no minimum order requirements. Is this possible with this app?
You need to create a product in Shopify and under the main product create variants that will be visible on the product page. So, all the variants will display under the main product and there will be a quantity selector for each variant. Your customer can choose their own combination of all products.
With this app, you can set the min and max quantity, so your customer must choose that quantity before going to the cart page. Additionally, through this app, you can apply restrictions for minimum-maximum quantities, predefined bundles, interval quantities, limits on variants, and orders that can be achieved. These restrictions can be set specifically on any particular product or a specific group of products also by using type, tag etc. Restrictions will be working also on non-variant products also.
You’ll get 3 days of trial along with great customer support for exploring all other features.
I’ve tried your code and found that if the product contains several options, the min limitation will fail when the option change.
So I made some update of the code, which set the default quantity of the variant selection to the minimum requirement, and the limitation can be applied to all the variant.
It should be pasted to the main-product.liquid, and find the quantity section:
Thanks for the code @KikyChen but for anyone finding this you also need to edit the main.cart file and any cart drawer liquid file with similar code otherwise they can just reduce the quantity there after adding product to cart. Also, warning “tags” don’t appear to be a valid selector in the cart or cart drawer, maybe use slug or title as qualifier.
Thanks for this code it works well for me where I have a MOQ, customers can increase the quantity using the arrow which is great, they cannot reduce the quantity using the arrow however they can manually type over the quantity which means they can order less than the minimum. Any way to stop this? Also @epidote mentioned this code needs to be added to the cart.liquid file, where in the liquid cart file should the code be added?
Hi CymCards, actually this code is not a 100% foolproof solution. There are multiple ways you can bypass the code. In 2024, I would recommend using an app like Cart Lock which can force to meet a minimum quantity for some specific products like using product tags and this restriction will work on the checkout page as well.
Open the app and click on the “Add a new rule” button.
Click “Add a new condition” and select the “Single item quantity” option.
Set 4 in the “Block if less than” field.
Click “Add a new condition” again and select the “Product tags” option.
Add “MIN4” in the “Product tags” field.
In the “Error message” field, add an appropriate message which will be displayed in the front-end.
You probably already found a solution but in case someone else visit this post, on the main-product.liquid file, probably under sections, look for the input type “quantity” html tag, should look like this:
copy the piece of code and change the property “min” to whatever is your MQO, that new code should be inside a conditional that will check a product by tag, in my case is the tag MQO10, below you will find the before and after code was updated: