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

Robin2011
Excursionist
16 0 4

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 quantitythis number needs to be the order quantityMetafieldsMetafields

Replies 8 (8)

DP_Development
Shopify Partner
120 14 30

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.
Robin2011
Excursionist
16 0 4

Hello, thanks for your reply,

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?

DP_Development
Shopify Partner
120 14 30

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 %}
...
...
add and style your description here
{% 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.
Robin2011
Excursionist
16 0 4

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². 

DP_Development
Shopify Partner
120 14 30

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.
Robin2011
Excursionist
16 0 4

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.

DP_Development
Shopify Partner
120 14 30

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.

markmead
Visitor
2 0 0

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.