SOLVED: How to set up minimum order quantities for each product

New Member
1 0 0

Brian,

I am not at all good with code. Would you by chance be available to help me with my store?

I'm trying to follow these discussions and my head is spinning.

 

I have only a few products on my store that require a minimum quantity to be ordered as well as a multiple of that quantity. 

Is there a solution to simply change the quantity numbering option on only certain product pages? Ie. Product A sells as a case of 6. I would love the quantity drop-down to start at 6, next 12, next 18 etc. An entirely different Product B on our store, sells as a case of 25. On that page I would love the quantity drop-down to start at 25, next 50, next 75 etc.
Other products, sell as individuals, so I need their drop-downs to stay as 1, 2, 3 etc.
I have simply tried minimum quantity apps, but they aren't built strong enough yet. Their "blockers" don't always work. 

0 Likes
Highlighted
New Member
2 0 0

Can this be done, setting a minimum quantity, for a particular product within the shop, without doing it to all of the items in the store?

0 Likes
Highlighted
New Member
1 0 0

I need this solution too. Has anyone figured this out?

0 Likes
Highlighted

Don't know what theme you are using - but in Debut, you could edit the product-template.liquid

 

The following code assumes that you will add product TAGS to your products as such.  

a) find a product you want to have a min of 100 as the starting # without allowing them to order less

b) add the TAG         min100    to this product and save the product

 

Go to Online Store --> Edit Code --> find product-template.liquid  or wherever your quantity code is for the product. Some themes have this in another file...

 

Find this code:

 

<select name="id" id="ProductSelect-{{ section.id }}" class="product-form__variants no-js">
{% for variant in product.variants %}
{%- include 'bold-variant' with variant, hide_action: 'skip' -%}
{% if variant.available %}
<option {% if variant == bold_selected_or_first_available_variant %} selected="selected" {% endif %} value="{{ variant.id }}">
{{ variant.title }}
</option>
{% else %}
<option disabled="disabled">{{ variant.title }} - {{ 'products.product.sold_out' | t }}</option>
{% endif %}
{% endfor %}
</select>

{% if section.settings.show_quantity_selector %}
<div class="product-form__controls-group">
<div class="product-form__item">
<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>


THEN ADD THIS CODE BELOW IN ITALICS:

<!--Convert the tags into a string by joining them with COMMA - setting tags per product for minimum order amounts -->
{% assign productTags = product.tags | join: ', ' %}
<!--Now Check for the desired tag name-->
{% if productTags contains 'min100' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="100" min="100" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>

{% endif %}

{% if productTags contains 'min48' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="48" min="48" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>

{% endif %}

{% if productTags contains 'min120' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="120" min="120" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>
{% endif %}

{% if productTags contains 'min36' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="36" min="36" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>

{% endif %}


THIS IS THE END OF THE CODE EDIT...



</div>
</div>
{% endif %}

<div class="product-form__error-message-wrapper product-form__error-message-wrapper--hidden{% if section.settings.enable_payment_button %} product-form__error-message-wrapper--has-payment-button{% endif %}" data-error-message-wrapper role="alert">
<span class="visually-hidden">{{ 'general.accessibility.error' | t }} </span>
{% render 'icon-error' %}
<span class="product-form__error-message" data-error-message>{{ 'products.product.quantity_minimum_message' | t }}</span>
</div>

 

 

You would then need to edit the cart and other pages so that a user could not change the number of items in the cart to less than your number but that is another few edits.

 

Remember, if you do it this way, you will need to add this code back to your template in the event there is an update to your theme.

 

So, I like to actually take all the code I created above and make a new (SNIPPET) page under SNIPPETS called      product-template-min-qty.liquid

Then paste all of the code above into this file.

 

I would then add this code below to the product-template.liquid page where the above code is now...

 

{% include 'product-template-min-qty' %}

 

This way, if the template gets edited, it is easy to just paste this one line of code where you need it.

 

Always go to EDIT --> Download Theme to have the theme sent to you so you have a backup.

 

Hope this helps someone.


Remember, the logic is only for the product page. If you wanted this for the collections page you would have to edit it there as well in the event you had quantities on your collection page.

 

James Byrne, Owner, Information Architect (USMC VET)
After Dark Grafx - Since 1992
"We Work After Dark, So You Don't Have To!"
https://www.afterdarkgrafx.com

Services: Website Design, Mobile App Development (iOS, Android, Windows), Ecommerce, Magento, Shopify, Miva, BigCommerce, Search Engine Optimization, Wordpress, Hosting, Graphic Design, Merchant Accounts, Consulting and all things web related!

Certified Partner/Developer/Affiliates: Shopify, Google Integrator, Wordpress, Zoho, AuthorizeNet, Geotrust and a Member of the San Diego Regional Chamber of Commerce, Veteran Owned Businesses, Veteran's In Business Network.

I also build custom apps for Shopify!
5 Likes
Highlighted
Excursionist
62 1 8

I have no coding experience AT ALL.  How can I get this done for 1 product that I have?

0 Likes
Highlighted

My solution via code is free.  Although it only applies to the product page, you could carry this over to other pages as needed.

James

James Byrne, Owner, Information Architect (USMC VET)
After Dark Grafx - Since 1992
"We Work After Dark, So You Don't Have To!"
https://www.afterdarkgrafx.com

Services: Website Design, Mobile App Development (iOS, Android, Windows), Ecommerce, Magento, Shopify, Miva, BigCommerce, Search Engine Optimization, Wordpress, Hosting, Graphic Design, Merchant Accounts, Consulting and all things web related!

Certified Partner/Developer/Affiliates: Shopify, Google Integrator, Wordpress, Zoho, AuthorizeNet, Geotrust and a Member of the San Diego Regional Chamber of Commerce, Veteran Owned Businesses, Veteran's In Business Network.

I also build custom apps for Shopify!
0 Likes
Highlighted
New Member
1 0 0

Hi, how do i edit the cart? 

 

this is my snippet:

 

{% assign productTags = product.tags | join: ', ' %}
{% if productTags contains 'min3' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="3" min="3" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>
{% endif %}
0 Likes
Highlighted
New Member
3 0 0

@After_Dark_Graf  is it possible to do this in the Cart only? We sell donuts and want a minimum purchase of 12 singles of any variety?

0 Likes
Highlighted
Sorry - it would be best to use an app for this. My code implementation
is for the basic product page. if we were to edit other pages in the
theme, we would need to know what apps you are using, etc.

When you use an app from the shopify store, they have more features and
actually build it out for all of the pages needed.

check out this one: https://apps.shopify.com/order-limits-minmaxify
James Byrne, Owner, Information Architect (USMC VET)
After Dark Grafx - Since 1992
"We Work After Dark, So You Don't Have To!"
https://www.afterdarkgrafx.com

Services: Website Design, Mobile App Development (iOS, Android, Windows), Ecommerce, Magento, Shopify, Miva, BigCommerce, Search Engine Optimization, Wordpress, Hosting, Graphic Design, Merchant Accounts, Consulting and all things web related!

Certified Partner/Developer/Affiliates: Shopify, Google Integrator, Wordpress, Zoho, AuthorizeNet, Geotrust and a Member of the San Diego Regional Chamber of Commerce, Veteran Owned Businesses, Veteran's In Business Network.

I also build custom apps for Shopify!
0 Likes
Highlighted
New Member
3 0 0

Thanks!
I was trying not to use any additional apps (to begin with) to reduce our subscription costs.

0 Likes