Variant inventory quantity always returning 0

karlkuusk
Tourist
3 0 1

The problem we are facing is that we can not get a meaningful value for variant.inventory_quantity. This page shows that this field is supported on a variant: https://shopify.dev/docs/themes/liquid/reference/objects/variant#variant-inventory_quantity.

The code snippet on the page that does not work as expected is in product-template.liquid:

unnamed.png

This is outputted a few lines later and gives the following result :
31956665237619:0,  
31956665270387:0,  
31956665335923:0
(It is saved into const newData variable in javascript that can be inspected on a rendered product pages. ->  https://seisuk.ee/collections/reguleeritavad-lauajalad/products/reguleeritavad-lauajalad-1-mootoriga )
 
So for all variants the quantity is 0 for some reason. Actual quantities are 8, 10, -16. 
In the other store the code builds on this and decides what to show based on the quantity. We would like to use the same approach/code, but can not figure out why the quantity always comes up as 0.
 
Where may be the reason?
Is there a way to debug this further? 
 
Replies 5 (5)

Bill6
Shopify Partner
47 0 17

I am having the same problem.  Looks like a bug.  Did you ever get a response on this?

karlkuusk
Tourist
3 0 1
We spent hours and hours searching for solution and countless emails with
Shopify support. But finally the solution was in one checkbox 🙂 Please
check if in Locations the following checkbox is enabled

[image: image.png]
haroldao
Shopify Partner
10 0 0

I cannot see your image...

What checkbox should I check?

Always Be Creative.
karlkuusk
Tourist
3 0 1

Settings -> Locations -> Your main location -> Details: Fulfill online orders from this location

 

jam_chan
Shopify Partner
891 23 171

Because this inventory_quantity field is not included in the variant object when the json filter is used

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview