Sell products only in multiple of 3

Andrea00
Tourist
14 0 0

Hi all,

 

I have a Shopify wine shop, and I am looking for a solution to allow me to keep the unit price but allowing only for quantities that are multiples of 3 (the packaging is only of 3 or 6 bottles). Does anybody know how I could achieve this?

0 Likes
PeanutButter
Shopify Partner
330 66 137

Hi, can you share the following:

- Theme you are using
- Your store url

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
Andrea00
Tourist
14 0 0
0 Likes
PeanutButter
Shopify Partner
330 66 137

cool.  I will provide solution tomorrow if nobody has done before

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
PeanutButter
Shopify Partner
330 66 137

hi @Andrea00,

Please try the following:

First of all I recommend making a copy of your theme and testing code edits there instead of doing it on your live theme.  

Open file Snippets/product-form.liquid and go around line 46.  Search for this line:

      <input class="product-form__quantity-input" type="number" id="Quantity-{{ section.id }}" name="quantity" value="1" min="1" pattern="[0-9]*">

 and replace it with:

      <input class="product-form__quantity-input" type="number" id="Quantity-{{ section.id }}" name="quantity" value="3" min="3" step="3" pattern="[0-9]*">

 As you can see, we have changed the initial and minimum values for the quantity input and we have set the step size to 3.

If this is what you are looking for please tell me and I will provide code to modify the quantity selectors for the cart page and dropdown carts

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
PeanutButter
Shopify Partner
330 66 137

hi @Andrea00 where you able to check my proposed solution?

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
Andrea00
Tourist
14 0 0

Hey @PeanutButter it works! Could you send the other necessary codes? Thank you so much!

0 Likes
PeanutButter
Shopify Partner
330 66 137

The next one is for the cart page at https://tessere-winery.myshopify.com/cart

On Sections/cart-template.liquid, on line 189. Replace this:

                <input id="quantity_{{ item.key }}" class="cart-item__qty-input" value="{{ item.quantity }}" type="number" pattern="\d*" min="1" name="updates[]" required data-cart-item-input-quantity>

 with:

                <input id="quantity_{{ item.key }}" class="cart-item__qty-input" value="{{ item.quantity }}" type="number" pattern="\d*" min="3" step="3" name="updates[]" required data-cart-item-input-quantity>

 

I will try to figure out the last one while you check this one out

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
PeanutButter
Shopify Partner
330 66 137

ok, and the last one is for the cart drawer (cart that appears from the right when you just have added to cart)

On file Snippets/cart-drawer.liquid, on line 138, you have to change this:

                <input id="quantity_{{ item.key }}" class="cart-drawer__item-quantity" value="{{ item.quantity }}" type="number" pattern="\d*" min="1" aria-label="{{ 'cart.general.item_quantity' | t }}" data-cart-item-input-quantity>

to this:

                <input id="quantity_{{ item.key }}" class="cart-drawer__item-quantity" value="{{ item.quantity }}" type="number" pattern="\d*" min="3" step="3" aria-label="{{ 'cart.general.item_quantity' | t }}" data-cart-item-input-quantity>

 

Peanut Butter Collective | Shopify Experts
- Was my reply helpful? Please Like and Accept Solution.
- Want to customize and improve your store? Hire us.
- Feel free to contact me us hello@peanutbutter.es
0 Likes
Andrea00
Tourist
14 0 0

All works in the copied theme! However it works if I do the selection with the arrows, if I write manually the number it allows the "wrong" values, like 14, 8... Do you have an idea how to avoid that as well?

0 Likes