Variant inventory quantity always returning 0

Highlighted
New Member
1 0 0

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? 
 
0 Likes