Debut theme: minimum order for some products

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 

Replies 2 (2)

LitExtension
Shopify Partner
4860 1002 1160

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

JimJong
New Member
56 0 0

Yes it is possible to set minimum order for some products by using the Cart Lock https://apps.shopify.com/cart-lock app easily. Here is how you can do it:.

 

  1. Open the app and click on the "Add a new rule" button.
  2. Click "Add a new condition" and select the "Cart subtotal" then put 50 in the "Block if less than" field.
  3. Click "Add a new condition" and select the "Products" then add your products.
  4. In the "Error message" field, add an appropriate message which will be displayed in the checkout page.
  5. Click "Match conditions " and add "ALL.
  6. Save the rule.

debutheme.png

 

Now your customers cannot checkout the specific products if the order amount is less than 50.