How to increase the quantity using decimal numbers

Solved

How to increase the quantity using decimal numbers

Renko2022
Excursionist
32 3 9

Hey there,

I would like to increase the quantity for ordering using decimal numbers (0.1, 0.2, 0.3...), not integers. That would apply only for products that use a default template (in the code below it's the first IF condition).
I hope you can give me a hand.
Regards,
Renko

 

{%- if template.suffix == nil -%}

<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="2"
value="2"
form="{{ product_form_id }}"
oninput="changeMaxQuantity(this, 24)"
>
<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 changeMaxQuantity(_this, max) {
if (_this.value > max) _this.value = max;
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 -%}

Accepted Solution (1)

LitExtension
Shopify Partner
4937 1007 1186

This is an accepted solution.

Hi @Renko2022,

Shopify does not support you entering Quantity as Decimal Numbers. Refer https://shopify.dev/themes/architecture/templates/product#the-quantity-input

Screenshot.png

So this is not possible.

Hope it is clear to you.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

View solution in original post

Replies 7 (7)

LitExtension
Shopify Partner
4937 1007 1186

This is an accepted solution.

Hi @Renko2022,

Shopify does not support you entering Quantity as Decimal Numbers. Refer https://shopify.dev/themes/architecture/templates/product#the-quantity-input

Screenshot.png

So this is not possible.

Hope it is clear to you.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
LitExtension
Shopify Partner
4937 1007 1186

Hi @Renko2022,

I saw you liked my answer. If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

wmt1
Visitor
2 0 1

Hi,

 

Did we resolve this issue of getting quantity in Decimal Numbers as this is what i needs also.

 

Please do let me know how can that be done?

 

Thanks,

Amar

Propero
Shopify Partner
897 101 160

While Shopify does not support decimal order quantities, there is a workaround which is being used by most fabric stores. For example

https://fabrics-fabrics.com/

 

The way it works is that the lowest fraction is considered a unit and quantities are manipulated for ordering the correct number. So 1.5 becomes 3 quantity of half unit.

 

- Was my reply helpful? Click Like or Click Accept as Solution
To hire: email us at shopify@propero.in
checkout our app https://apps.shopify.com/picamaze
3-designers
Shopify Partner
1 0 0

how is it done? by app?

 

Emorrison09
Tourist
3 0 2

is this something that you helped implement? if so, we may need your services

atif786786
Visitor
1 0 0

I can do it for you

 

aatif6325@gmail.com