Selling products in minimum of 5 and multiple of 5

Solved
dedeeren88
Tourist
11 0 1

Thanks for answer,

Please find my shop below;

https://kimyasalburada.com/en/products

It hasn't finished even not translated yet, sorry for that.

I have tried different variations to solve my problem on each product but in this topic I have found what I need actually.

Regards,

Eren

 

0 Likes

Hi @dedeeren88 ,

you are using the theme Minimal. It is much simpler there. In the Shopify Admin just go to your Online Store->Themes->Actions->Edit Code. Then in the folder 'Sections' open the file 'product-template.liquid' and search for  product-single__quantity. Then add to the input tag the attribute step=30 so that it looks like

<input type="number" id="Quantity" name="quantity" value="30" min="30" step="30" class="quantity-selector">

Be aware that this will applied to all of your products. If this is a problem you have to set up different templates for the products which you can then select when you add products.

Hope this will help.

Regards
Thomas

 

• War meine Antwort hilfreich? Hinterlasse bitte ein Like.
• Hat meine Antwort Dein Problem gelöst? Bitte akzeptiere sie als Lösung.
dedeeren88
Tourist
11 0 1

Dear Thomas,

Yes it is worked thanks a lot and yes I have different variations(1,20,25,30,50) but I don't really know how to set up different templates.

 

And also with this change I need another small change like I have to add every products price "/kg".

for example:

dedeeren88_0-1614251357224.png it should be shown $3.00/kg

Thanks again,

Eren

 

0 Likes
Emfab
Tourist
7 0 4

Hi Eren,

If you are only selling whole bags, another way you could do it would be to have quantity set to 1 (1 bag), display a price per bag and also display price per kg. This way you won't need different product templates. You can display 2 prices using sections of the code below.

                    {% assign productPriceMetre = product.selected_or_first_available_variant.price | times: 10 %}
                    {% assign productPriceMetreCompare = product.selected_or_first_available_variant.compare_at_price | times: 10 %}
                    
                    <div class="price  {% if section.settings.show_smart_checkout %} smart_checkout_price_pos {% endif %}">
                      {% unless product.price_max == 0 and settings.custom_price0_text != blank %}
                      	{% if product.vendor != 'Unit' %}
                      		AU {{ productPriceMetre | money }} per metre
                      		<p>AU {{ product.selected_or_first_available_variant.price | money }} per 0.1 metre
                      	{% else %}
                        	<span id="productPrice"  class="money">AU {{ product.selected_or_first_available_variant.price | money }}</span>                      		                    
     					{% endif %}
                     {% else %}
          					<p><span id="productPrice"  class="money">{{settings.custom_price0_text }} per 0.1 metre</span></p>   
                     {% endunless %}                      
                      {% if product.selected_or_first_available_variant.price < product.selected_or_first_available_variant.compare_at_price %}
                      <p><span id="comparePrice" class="money">
                        {% if product.vendor != 'Unit' %}
                        	AU {{ productPriceMetreCompare | money }} per metre
                        {% else %}
                        	AU {{ product.selected_or_first_available_variant.compare_at_price | money }}
                        {% endif %}
                        </span></p>
                      {% endif %}
                    </div>

In your case you can use the product.vendor to set the different bag weights to the different products. Eg. product.vendor = "Bag 25" would divide the price per bag by 25 and product.vendor = "Bag 30" would divide the price per bag by 30 to give you price per kg.

Hope this helps

Shayne

Hi @dedeeren88 ,

maybe you start another thread with the new question:


@dedeeren88  wrote:

tewe_0-1614329585545.png

 it should be shown $3.00/kg


See https://help.shopify.com/en/manual/intro-to-shopify/initial-setup/sell-in-germany/price-per-unit

Regards
Thomas

• War meine Antwort hilfreich? Hinterlasse bitte ein Like.
• Hat meine Antwort Dein Problem gelöst? Bitte akzeptiere sie als Lösung.
0 Likes
AlexB87
Tourist
11 0 2

Hi there,

I am trying to do the exact same thing for my store.

My theme is Venture and I dont see the script.js file so assume this is theme related.

I have created a new product template, and have linked it to a new section. The page is loading as expected but the multiples requirement is NOT working as expected. Below is an extract of the coding from the section:

<div class="product-form__item product-form__item--quantity">
<label for="Quantity">{{ 'products.product.quantity' | t }}</label>
<input type="number" id="Quantity" name="quantity" value="3" min="3" step="3" class="product-form__input product-form__quantity" >
</div>

When I load the page the qty starts on 3 unit, but clicking the + or - button allows you to move 1 unit, I would like this to move 3 units.

Im guessing this now links to some java script somewhere as well?

Thanks in advance!

0 Likes

Hi @AlexB87 ,

the code is in the file theme.js and it is attached to the buttons.

  QtySelector.prototype.adjustQty = function(evt) {
    var $el = $(evt.currentTarget);
    var $input = $el.siblings('.js-qty__input');
    var qty = this.validateQty($input.val());
    var line = $input.attr('data-line');

    if ($el.hasClass('js-qty__adjust--minus')) {
      qty -= 1;
      if (qty <= this.settings.minQty) {
        qty = this.settings.minQty;
      }
    } else {
      qty += 1;
    }

    if (this.settings.isCartTemplate) {
      $el.parent().addClass(this.settings.loadingClass);
      this.updateCartItemPrice(line, qty);
    } else {
      $input.val(qty);
    }
  };

But it might be better to leave that part untouched and define your own style class and functionality.

Regards
Thomas

 

• War meine Antwort hilfreich? Hinterlasse bitte ein Like.
• Hat meine Antwort Dein Problem gelöst? Bitte akzeptiere sie als Lösung.
0 Likes
AlexB87
Tourist
11 0 2

Thanks Thomas,

Surely this would change the button settings for all of my products? I just want it specifically for this template, the rest of my products will utilize the original template.

Hi @AlexB87 ,

yes, that is the reason I wrote "define your own style class and functionality".  So just make a copy of the code  define your own class and put it into your template. If your are not comfortable with that let me know.

Regards
Thomas

• War meine Antwort hilfreich? Hinterlasse bitte ein Like.
• Hat meine Antwort Dein Problem gelöst? Bitte akzeptiere sie als Lösung.
0 Likes
AlexB87
Tourist
11 0 2

OK, I think I understand.

One concern, I've tried another method which essentially worked, but when added it to the cart, and then moved to the shopping cart I was then able to make changes to the qty 1 unit at a time, which essentially defeats the purpose of the change. So the product page worked but the shopping cart didn't recognize the change - if that makes sense?

0 Likes