How to limit purchase quantity?

New Member
8 0 0

I want to limit quantity on orders placed at the website. It will be like customers can't place orders of more than 5 pieces. I am using everything theme

0 Likes
Highlighted
Shopify Staff
Shopify Staff
506 28 167

Hi, @rhizmall

Rae from Shopify here. I'm glad you reached out about this! I can certainly lend a hand. 

The best way to create limits on product quantities that customers can order is by using an app. Some of the options I recommend checking out for this are: 

Each of these apps can be used to create minimum and maximum order limits on carts, so I believe they will suit your needs well. 

It is important to add however, that these are all third-party apps that are created and fully supported by developers who are external to Shopify. With this in mind, if you have any questions or concerns about using these apps, or the charges associated with these apps, please reach out to the app developers directly for more assistance. 

In the meantime though, I'd love to hear more about the products you're selling, and how you're hoping to use order limits on your site. Will these be used for sale products, or as part of a discount you're running?

Talk soon! 

Rae | Social Care @ Shopify
Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it Accept as Solution to help others locate the answer!
To learn more visit the Shopify Help Center, or the Shopify Blog.

0 Likes
Highlighted
New Member
8 0 0

Glad for your Reply.

Is there any Free app? or any integration/setting which I have to set in cart.liquid file 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
506 28 167

Hi, @rhizmall

Thanks for following up. 

While I don't have any personal experience with free apps that can help set order limits, if any apps like this exist they'll be listed here

In terms of a coding solution, I recommend reaching out to Shopify Experts about this for more information. Experts are third-party developers and coders who are very knowledgeable and skilled with using our platform, so they're a great resource to use for tasks like this. You can contact them via the 'Create a job'  button here

Let me know if there's anything else I can help with! 

Rae | Social Care @ Shopify
Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it Accept as Solution to help others locate the answer!
To learn more visit the Shopify Help Center, or the Shopify Blog.

0 Likes
Highlighted
Explorer
60 4 4

Yes you can do it through custom code
// check tag on products

       {% assign limit = 'no' %}
       {% for tag in product.tags %}  
              {% if tag contains 'limit_' %}    
            {% assign tagName = tag | remove: 'limit_' %}
              {% assign limit = 'yes' %}
               {% break %}
              {% endif %}
           {% endfor %}
 
// Js code
       function getFilterProducts(tag){
             var maxq;
    $.ajax({
        type: 'GET',
          async: false,
        url: '/products/'+tag+'.json',
        dataType: 'json',
        success: function(pdt){
          var pdttags = pdt.product.tags.split(",");
                  var limi = pdttags.find(a =>a.includes("limit_"));
              if(limi){
                limi.split("_");
                limi = limi[limi.length - 1];
                  maxq = limi;
              }
        },
        error: function(status){
          //   alert(status);
        }
    })
   
    return maxq;
    }



  
{% if limit == 'yes' %}
{% include 'quantity-input2', id: section_id, qty: 1, min: 1, max: tagName %}
{% else %}
{% include 'quantity-input', id: section_id, qty: 1, min: 1, max: current_variant.inventory_quantity %}
{% endif %}
0 Likes
Highlighted
New Member
8 0 0

i want to know the code which i have to place on my website where customer cannot select more then 5 products on checkout

0 Likes
Highlighted
New Member
8 0 0

Hi, Kumar

I have placed it in my theme.liquid file also in addtocart.liquid file but it didn't worked kindly guide me where to place this code.

 

0 Likes
Highlighted