Debut theme: minimum order for some products

Rlmps11
Visitor
3 0 0

Hello,

 

I need to set a minim order for some products, I change the minimum quantity from product-template.liquid, now I need to fixed this minimum amount also in cart-template.liquid for obtain a minimum order.

I write those code:

Product-template.liquid:

Click to expand...

<label for="Quantity-{{ section.id }}">{{ 'products.product.quantity' | t }}</label>


{% assign productTags = product.tags | join: ', ' %}

<!--Now Check for the desired tag name-->
{% if productTags contains 'min1072' %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="1072" min="1072" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>
{% else %}
{% if productTags contains 'min1500' % %}
<input type="number" id="Quantity-{{ section.id }}"
name="quantity" value="1500" min="1500" pattern="[0-9]*"
class="product-form__input product-form__input--quantity" data-quantity-input
>

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


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

cart-template.liquid

Click to expand...

<label for="updates_{{ item.key }}" class="cart__qty-label" aria-label="{{ 'cart.label.quantity' | t }}" data-quantity-label-mobile>
{{ 'cart.label.qty' | t }}
</label>

 

{% assign productTags = product.tags | join: ', ' %}

<!--Now Check for the desired tag name-->
{% if productTags contains 'min1072' %}
<input id="updates_large_{{ item.key }}" class="cart__qty-input" type="number"
value="{{ item.quantity }}" min="1072" pattern="[0-9]*"
data-quantity-input data-quantity-item="{{ forloop.index }}" data-quantity-input-desktop data-role="product-quantity-desktop">
>
{% else %}
{% if productTags contains 'min1500' % %}
<input id="updates_large_{{ item.key }}" class="cart__qty-input" type="number"
value="{{ item.quantity }}" min="1500" pattern="[0-9]*"
data-quantity-input data-quantity-item="{{ forloop.index }}" data-quantity-input-desktop data-role="product-quantity-desktop">
>

{% else %}
{% if productTags contains 'min5250' % %}
<input id="updates_large_{{ item.key }}" class="cart__qty-input" type="number"
value="{{ item.quantity }}" min="5250" pattern="[0-9]*"
data-quantity-input data-quantity-item="{{ forloop.index }}" data-quantity-input-desktop data-role="product-quantity-desktop">
>


{% else %}
<input id="updates_large_{{ item.key }}" class="cart__qty-input" type="number"
value="{{ item.quantity }}" min="1" pattern="[0-9]*"
data-quantity-input data-quantity-item="{{ forloop.index }}" data-quantity-input-desktop data-role="product-quantity-desktop">
>
{% endif %}
{% endif %}
{% endif %}

How can I solve?

I'm apologise: if I click on html I can't publish my post 

Reply 1 (1)

LitExtension
Shopify Partner
4860 1001 1135

Hi @Rlmps11,

I checked and see the code has been added, what do you want us to solve? Code not working at cart-template.liquid?

Please explain more about it, I will help you check it.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify