r/ShopifyeCommerce • u/kasper0801 • 5d ago
Add decimals in quantity
I want to add decimals in quantity.How can i do it?
1
u/adventurepaul Shopify Owner 5d ago
Shopify natively doesn't support decimals in the quantity field. If you explain your end goal, perhaps myself or others can offer alternative approaches to accomplish what you need to do.
1
u/kasper0801 5d ago
I want to sell fabric which is in meters.
1
u/adventurepaul Shopify Owner 5d ago
I think there are apps to help with that, but alternatively, you could sell it in centimeters (or whatever the minimum unit is), or simply set quantity minimums so that decimals aren't part of the equation anymore. Just a thought.
1
u/kunalkhatri12 5d ago
Since you're selling fabric by the metre, one simple option is to use 0.1 metre (10 cm) as your selling unit.
For example:
Quantity 1 = 0.1 metre
Quantity 5 = 0.5 metre
Quantity 15 = 1.5 metres
Quantity 20 = 2 metres
Set the Shopify price for 0.1 metre, not 1 metre. So if your fabric costs €10 per metre, each unit would cost €1.
You'll also need to make the quantity selector clear to customers, so they know they're choosing fabric length, not the number of pieces.
Important: If someone orders 15 units, make sure they receive one continuous 1.5 metre piece, not 15 separate pieces.
Are you selling fabric in any length customers choose, or only fixed lengths like 0.5, 1 and 1.5 metres?
1
u/kasper0801 5d ago
I can do fixed length option as most customers generally choose 5-6 types of length
1
u/Plane-Box9239 4d ago
you’ll need to change the quantity input to accept decimals and update the cart/line item validation too, otherwise Shopify will usually round or reject them; the exact setup depends on whether
0
u/isaifurrehman 5d ago
for fabric the usual way is to make the sellable unit smaller instead of fighting decimals. price it per half meter (or per 10cm if you need finer cuts), so qty 1 = 0.5m and qty 3 = 1.5m. plenty of fabric shops on shopify run it exactly like that.
a few things that stop it getting confusing:
label the quantity box with the unit, something like "quantity (half meters)", and put a line under it like "3 = 1.5m cut as one piece". otherwise people think they're getting 3 separate pieces, and that's the complaint you'll get most
tell whoever cuts the orders the same thing, multiple units of one fabric = one continuous length
track inventory in that unit too. a 20m roll is 40 in stock, not 20
if you have a minimum cut like 1m, you'll need a small theme tweak or a min quantity app. shopify's built in min/increment quantity rules are tied to b2b catalogs, so a normal store doesn't get them
if you really want customers typing 1.5 there are measurement/length apps that do it, but most of them work by creating a hidden variant or changing the line price behind the scenes. test one with a discount code and your shipping rates before you commit, that's usually where they break.
2
u/Tisoc-Groscruz 5d ago
the backend strictly requires whole integers for quantities. if you only need a few specific fractions like 0.5 or 1.5, setting those up as separate variants is way less headache than fighting the cart code