New Shopify Certification now available: Liquid Storefronts for Theme Developers

Variant inventory quantity always returning 0

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:

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


This is outputted a few lines later and gives the following result :
(It is saved into const newData variable in javascript that can be inspected on a rendered product pages. -> )
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)
Shopify Partner
47 0 13

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

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]
Shopify Partner
9 0 0

I cannot see your image...

What checkbox should I check?

Always Be Creative.
3 0 1

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

Shopify Partner
856 23 161

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