Tourist
9 0 1

## Changing what Shopify reads as "Quantity" for a product order

Hi all!

I need Shopify to put out squaremeters as my orderquantity. Instead of "5 boxes" i need it to put out "25m²". We have coded an individual calculator that lets customers put in their desired squaremeters of flooring and then shows the next best number of prepackaged boxes they would need. I can't use unit prices because we had to use individual metafields. We use an Ecommerce Management System (JTL) that prevents us from using unit prices. Is there a way i can make shopify treat product quanitities like this?

this number needs to be the order quantityMetafields

Replies 8 (8)
Pathfinder
83 11 19

## Re: Changing what Shopify reads as "Quantity" for a product order

Hi Robin,

this is not possible as for shopify the quantity is something like 1 Product. So you cant buy just a fraction of a product which is the reason for shopify to work only with int numbers. You could reach your goal by describing the quantity in a different way. So for example a quantity of 1 could be 0.1qm.

Software Engineer and Frontend Developer
Fast, cheap and straightforward solutions! Shall I do this for you? Just send me a message!
Please click on like and "accepted solution" if my answer helped you.
Tourist
9 0 1

## Re: Changing what Shopify reads as "Quantity" for a product order

Yes, i am trying to describe a quantity of 1 as 3,955qm, which is why i set up these metafields. How would i go about doing this the right way?

New Member
2 0 0

## Re: Changing what Shopify reads as "Quantity" for a product order

I had a similar situation with a flooring provider and their solution was to have the quantity calculated based on the customers required `width` and `length` and then to round it up.

So if a customer needed 3m x 4.5m it would figure out how much they needed based on how much a pack of the flooring would contain, round that value up and set that as the quantity.

In that example there's 2.39m2 in a pack.

3 x 4.5 = 13.5

13.5 / 2.39 = 5.6

Quantity = 6

This doesn't work for everyone but they were happy with that approach and it's been quite successful for them.

Pathfinder
83 11 19

## Re: Changing what Shopify reads as "Quantity" for a product order

I had a similar problem with my products, as I wanted to sell 0.5m pieces 🙂 I solved it like this: https://www.stoffdorado.de/collections/stoffe-farbe-uni/products/jersey-uni-schwarz

If you want to add a description somewhere near the quantity selector, you can add the text in your product template in between the following block:

``````{% if section.settings.show_quantity_selector %}
...
...
{% endif %}``````

Software Engineer and Frontend Developer
Fast, cheap and straightforward solutions! Shall I do this for you? Just send me a message!
Please click on like and "accepted solution" if my answer helped you.
Tourist
9 0 1

## Re: Changing what Shopify reads as "Quantity" for a product order

Your solution only shows how to display it in the front end, but it doesnt show up as 50cm in the order, it still uses integer numbers right?

i thought this would work with the unit prices. If i can tell shopify how much quantity there is for a specific price, it should also be able to deduct how much of that quantity the customer has ordered. So my unit price is 3.955m² for 158€. If the customer pays 474€, it should be easy to tell shopify that the order quantity is 11,865m².

Pathfinder
83 11 19

## Re: Changing what Shopify reads as "Quantity" for a product order

There is no 100% clean solution for this issue, because the backend only accepts integers. There's only a dirty solution by calculating with int in the backend and showing a decimal at the frontend. This will work for the cart, but at some point you will have to explain your customer why he sees a quantity of for example 120, although he wanted to order 1.2.

Software Engineer and Frontend Developer
Fast, cheap and straightforward solutions! Shall I do this for you? Just send me a message!
Please click on like and "accepted solution" if my answer helped you.
Tourist
9 0 1

## Re: Changing what Shopify reads as "Quantity" for a product order

I just learned that this can be done with line item properties to customize a product. I need to test if my management system can read that as order quantity now.

Pathfinder
83 11 19

## Re: Changing what Shopify reads as "Quantity" for a product order

The line item properties is just an array, so i cannot imagine, how this should solve the problem. Good luck though 🙂

Software Engineer and Frontend Developer
Fast, cheap and straightforward solutions! Shall I do this for you? Just send me a message!
Please click on like and "accepted solution" if my answer helped you.
Top Contributors