How do I set and display the minimum order quantity in the quantity selector bar?

Hello all,

I really need your help in setting and displaying the quantity selector bar to “3” and “10” for 2 different product types instead of “1” , so the minimum quantity that the customer could order would be 3 for 1 Nova Water, 40 Plastic Bottles X 330 ml and 10 for 2 Berain Water, 40 Plastic Bottles X 330 ml. I want to avoid having customers ordering less than the displayed quantities for each product type. I don’t want to use a third party apps to do what I’m looking to achieve. I have attached a Google Docs link below that shows you all my main-product.liquid code file.

Google Docs Link:

https://docs.google.com/document/d/12GGGDq-zc5qmjQgS4ncPHaNWkr4YVtYUf6R4_g7vIYo/edit?usp=sharing

My store URL: https://u7yeji-na.myshopify.com

Hope anyone can help me.

Regards,
Mamdouh

Hello

Yes. I can help you with this. Please check the url given below. I have implemented this in that store of mine.

Store URL: https://enumbin-test-sandbox.myshopify.com/

Password: 1

Check products;

  1. Pants RTE Test. (Minimum set to 3) https://enumbin-test-sandbox.myshopify.com/products/rte-test

  2. Example Beanie. (Minimum set to 5) https://enumbin-test-sandbox.myshopify.com/products/example-hat

If you think this is what you want. Tell me I will provide the process.

1 Like

Hi @enumbin ,

Yes, this is exactly what I’m looking for. So, your help is much appreciated :slightly_smiling_face: Can you provide me the process and walk me throguh step by step on how to do my mine like yours? Thanks.

Hello @Mamdouh_USD

Sorry for the late reply, brother. I was outside the whole day. Sure, I will describe the entire process below with screenshots.

Step 1: First, create a custom metafield for the products. See the shot https://prnt.sc/v7jNDAVncC5Vhttps://prnt.sc/ZYC2xU0Y5y2n

Step 2: Then go to products and you will see the metafield at the bottom. Put a quantity for that. See the shot https://prnt.sc/02jEVD5GO7DN

**Now the coding part. (**Go to theme code → https://prnt.sc/rJj3aG8y82Z8 )

For the product page

Step 3: Find the “main-product.liquid” file.

Step 4: Find the “quantity-input” component and follow the shot https://prnt.sc/rSqnp6b3PS9C

Step 5: Replace the data-min and min attribute whole with the code given below.

Code for the product page:

data-min="{{ product.metafields.namespace.key | default: product.selected_or_first_available_variant.quantity_rule.min }}"
min="{{ product.metafields.namespace.key | default: product.selected_or_first_available_variant.quantity_rule.min }}"

** For the namespace.key part use the namespace.key you copied earlier at Step 1. I used custom.minimum_order_quantity

For the cart page

Step 6: Find the “main-cart-items.liquid” file.

Step 7: Then find the “quantity-input” and dollow the shot https://prnt.sc/5cebyYacSjMA and do the same. I have given the code below.

Code for Cart Page:

min="{{ item.product.metafields.custom.minimum_order_quantity | default: 0 }}"
data-min="{{ item.product.metafields.custom.minimum_order_quantity | default: item.variant.quantity_rule.min }}"

** For the namespace.key part use the namespace.key you copied earlier at Step 1. I used custom.minimum_order_quantity

Let me know if you were able to do it. If you give me collab access, I can do it for you if you want.

Regards

1 Like

No worries @enumbin . I just want to let you that your solution just worked fine. And thank you for your kind help :slightly_smiling_face: Can I message or send you a private message? Thank you so much.

Hello @Mamdouh_USD

Sure. Anytime you can send me a message.