r/ShopifyeCommerce • u/kasper0801 • 9d ago
Add decimals in quantity
I want to add decimals in quantity.How can i do it?
4
Upvotes
r/ShopifyeCommerce • u/kasper0801 • 9d ago
I want to add decimals in quantity.How can i do it?
2
u/Tisoc-Groscruz 9d 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
1
u/adventurepaul Shopify Owner 9d 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/kunalkhatri12 9d 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/Plane-Box9239 8d 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
1
u/Repulsive_Bank_2204 Ecommerce Software Provider 2d ago
shopify only stores whole units, so decimal qty needs a workaround. either sell in smaller units as variants (100g, 0.5m) or use an app that splits the cart. theme edits wont work because checkout validates integers
0
u/isaifurrehman 9d 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:
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.