Item quantity limit = min (constant, available inventory)

Hello! I’d like to add a fixed global per-item limit of say 20 (that is, in addition to the existing inventory max limit). So max add-to-cart/in-cart for any item is lesser of 20 and available inventory.

Paid app functionality is overkill for my use case and I probably just need an at_most: or similar in the correct spot(s)? Any help is appreciated! Cheers

Hi @MisterC ,

You are wanting the quantity limit to be 20, if the customer enters more than 20 it will automatically revert back to 20 for each product?

Please send me the theme name, I will check and guide you in detail.

@LitExtension Yes, that is exactly the desired function. (And of course if they entered more than 20 and the available inventory was 5, it would return 5). The theme is Drop by We Are Underground.

@LitExtension - I also need my cart to limit quantity purchased. I need a minimum limit of 2 and a maximum of 20. I’m only selling one product in my cart. My theme is Debut.

Hi @MisterC ,

Does your product have many variants?

Because when there are many variants you need to add JS to change the max and min of quantity so it will be more complicated requirement and you need to hire expert for it.

Hope it is clear to you.

Hi @LB2022 ,

You can create a question on the community and send me the link. I will check it.
Because this will help build a better community.
Thank you.

@LitExtension 99% of my products have no variants. For the occasional ones that do, if the desired functionality is problematic/complex, inventory will usually be limited anyways and the standard functionality would be fine.

For what I had in mind as possible approach though I wasn’t thinking variants mattered. Particularly, the native behavior already handles inventory limitation by variant. No mods needed there. My thought was to add on to the existing logic (that is, item quantity limit = available inventory) an extra check (that is, item quantity limit = min (20, available inventory). Like with an at_most: function or similar. But my attempts failed, ergo here we are lol.

Cheers!

Hi @MisterC ,

Please send me the code of product-template.liquid file, I will check and guide it for you

Hi @MisterC ,

Go to product-buttons.liquid file and add code here:

Code:


Hope it helps!

Hey @MisterC ,

This extension **Limit Quantity Purchase**helps you to set the maximum and minimum quantities for your store.

The features of this app are as below:

  1. Specific Product purchase limits Minimum and Maximum.

  2. Flexible Purchase Limit of items within a group of products.

  3. Apply Limit For individual products or collection

It has all the features that you have mentioned in your query. Please, check it out here for more details: Shopify Limit Qty Purchase

Hope this helps you.

Thank you.

I would like to know if the script can be used to restrict only 1 item in the cart and the quantity also in 1 item? That’s what I need. Only one item can be added to the cart and the quantity is also limited to 1.

Sure, that works, but you can still add the item to the cart again if you’re on a Featured Product page, the page isn’t refreshing, so you can still add 1 after 1 after 1 etc to the cart…

I noticed your question about combining limits with inventory. In DC Order Limits, you can set a fixed max quantity rule that works alongside your Shopify inventory settings.

Setup:

  1. Create an order limit rule with a max quantity of 20

  2. Apply it to all products or only the products you want to restrict

  3. At checkout, the effective cap is whichever is lower, your rule limit or the available inventory

The rule still caps purchases even if inventory is higher.

Let me know if this setup works for you, happy to help if you run into anything.