Liquid, JavaScript, themes, sales channels
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:
<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
<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
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.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024