Set quantity input to start at a number larger than 1

KiwiDesigner70
Shopify Partner
1 0 0

Hi all,

 

I have set up the following to work for products that need to start with a quantity of 10.  The MIN10 tags are all set up and I thought the following code should work but it doesn't.  The  number 10 appears for a second and is then replaced with the 1.  Note that the site is in development, but I don't think it should make a difference?

 

Thanks in advance for your help.

 

Here's the code:

 

{% if product.tags contains 'MIN10' %}
<quantity-input class="quantity">
<button class="quantity__button no-js-hidden" name="minus" type="button">
<span class="visually-hidden">{{ 'products.product.quantity.decrease' | t: product: product.title | escape }}</span>
{% render 'icon-minus' %}
</button>
<input class="quantity__input"
type="number"
name="quantity"
id="Quantity-{{ section.id }}"
min="10"
value="10"
form="{{ product_form_id }}"
oninput="changeMinQuantity(this, 10)"
>
<button class="quantity__button no-js-hidden" name="plus" type="button">
<span class="visually-hidden">{{ 'products.product.quantity.increase' | t: product: product.title | escape }}</span>
{% render 'icon-plus' %}
</button>
</quantity-input>
<script>
function changeMinQuantity(_this, min) {
if (_this.value < min) _this.value = min;
return;
}
</script>
{% else %}
<quantity-input class="quantity">
<button class="quantity__button no-js-hidden" name="minus" type="button">
<span class="visually-hidden">{{ 'products.product.quantity.decrease' | t: product: product.title | escape }}</span>
{% render 'icon-minus' %}
</button>
<input class="quantity__input"
type="number"
name="quantity"
id="Quantity-{{ section.id }}"
min="1"
value="1"
form="{{ product_form_id }}"
>
<button class="quantity__button no-js-hidden" name="plus" type="button">
<span class="visually-hidden">{{ 'products.product.quantity.increase' | t: product: product.title | escape }}</span>
{% render 'icon-plus' %}
</button>
</quantity-input>
{% endif %}

Replies 0 (0)