How to set up minimum order quantities for each product?

Highlighted
Tourist
5 0 1

I am trying to set up minimum order quantities for our products on our wholesale site. Each product has a different minimum order quantity. Some products must be ordered in multiples of 2, 3, 4, 6 and so on. I tried using tags ("includes" & "multiple x"), but this doesn't seem to be enforcing any minimums. 
Do you know how to require these minimum amounts? I am having trouble figuring it out.
Also, they should only be allowed to update quantities in multiples of 2, 3, 4, or 6, depending on the minimum for each product.

I really appreciate your help.

1 Like
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 139

The only thing I can think here is to try the minimum orders app: http://apps.shopify.com/minimum-orders

It may get you close to what you are looking for.

http://shopifyplus.com ::: http://twitter.com/bacchus
0 Likes
Highlighted
Tourist
5 0 1

Thanks again Jamie!

Our developer just created some code that he inserted into the cart and that solved the issue!

 

0 Likes
Highlighted
New Member
2 0 1

Clearly I'm late to the party, but would you mind sharing the code?  I'm finding the app options to be less than desirable.

Any help is appreciated. thanks

www.themoroccanbakery.com || www.facebook.com/TheMoroccanBakery || www.twitter.com/MoroccanBakery ||
0 Likes
Highlighted
New Member
2 0 0

If we can get the code as well, that would be greatly appreciated!  Thank you.

0 Likes
Highlighted
New Member
5 0 0

I would also enjoy that bit of code.

Please and Thank you

 

Edit: I found this on another thread:

{% if cart.total_amount >= XXX %} <p>You need to purchase x items to checkout</p> {% else %} <input type="submit" value="Continue to checkout" name="checkout" /> {% endif %}

This would not show the checkout button to submit the form unless there cart totalled your given amount. You could also use the number of items as well by replace the if statement with this.

{% if cart.items_count >= X %}

(Edit: Updated some of this code)

_______

I changed it a bit to work with my theme. 

I have a couple problems:

  • Every product now has a minimum and not all of my products need a minimum.
  • When I have products with different minimums in a cart, it only take one with the correct quantity to allow the purchase to be made.

If anyone can give me any pointers that would be great, Thanks. 

0 Likes
Highlighted
Tourist
5 0 4

Chris,

Did you ever get your two remaining problems with this solution sorted? I too would like to try this in my cart, but only have one item in my shop that needs this minimum check applied to it.

0 Likes
Highlighted
New Member
4 0 0

I am looking for code to this as well... but take it one step further... Have it apply minimum orders to certain tags only.  I have wholesale customers that I need them to purchase a minimum quantity.  If anyone has any insight I would greatly appreciate it!


mo

0 Likes
Highlighted
New Member
5 0 0

Dan and Mo,

So I found some things on Stack overflow. This is what I have for now, it really only works for one tag and one amount of a item.

{% assign show_checkout_button = true %}
{% for item in cart.items %}
  {% if item.product.tags contains 'SampleTag' and item.quantity <= 49 %}
    {% assign show_checkout_button = false %}
    <p>You will need to purchase more than 50 of the product "{{ item.product.title }}"</p>
  {% endif %}
{% endfor %}
{% if show_checkout_button %}
  <!-- show checkout button -->
{% endif %}

you need to put your checkout button in, add your tag ('SampleTag'), and use what ever number you want. 

I am going to keep playing with it. 

0 Likes
Highlighted
New Member
4 0 0

Alright... ive got mine working.  Thanks for the help.  I have set my minimum order to 50 and using the customer tag test.  Its working, will need to clean up the error message a bit and perhaps also make a error sound but for now its functional.

My code below.


 <!-- custom check for minimal items and gets a count of those items -->
 {% assign cartcount = 0 %}
 {% for item in cart.items %}
  {% if customer.tags contains "test" and cart.item_count <= 49 %}
  {% assign buttoncheck = 'yes' %}
  {% capture cartcount %}{{ cartcount | plus: item.quantity }}{% endcapture %}
  {% endif %}
{% endfor %}
 {% assign cartcount = cartcount | times: 1 %}
 <!-- if minimal items are in the cart, hide the checkout button unless they are ordering the proper amount -->
{% if buttoncheck == 'yes' and cartcount < 49 %}
  <div style="float:right;font-weight:bold;text-align:right;width:400px;margin-bottom:20px;">You must purchase a minimum of 50 items to checkout. Please update your quantities or add more continue shopping<a href="/collections/all">Continue Shopping &rarr;</a></div>
 <div class="clearfix"></div>
{% endif %}
 {% if buttoncheck == 'yes' and cartcount >= 50 %}
 <input type="submit" class="action_button" id="checkout" name="checkout" value="Checkout" />
 {% endif %}
{% if buttoncheck != 'yes' %}
 <input type="submit" class="action_button" id="checkout" name="checkout" value="Checkout" />
{% endif %}
 

0 Likes