Variant inventory quantity always returning 0

Topic summary

Issue: variant.inventory_quantity in Liquid always returned 0 for all variants on product pages (e.g., IDs mapped to 0), despite actual stocks like 8, 10, and -16. Code populated a JavaScript newData object from Liquid output.

Resolution: The root cause was a Shopify Locations setting. Enabling “Fulfill online orders from this location” fixed the zero values.

  • Path: Settings → Locations → [Main location] → Details → check “Fulfill online orders from this location”.

Additional clarification: inventory_quantity is not included when the variant object is serialized with the Liquid json filter. If using | json, that field will be missing/ignored; access it directly in Liquid or pass it explicitly before converting to JSON.

Status: Resolved by enabling the Locations checkbox; with a note to avoid relying on the json filter for inventory_quantity.

Summarized with AI on January 19. AI used: gpt-5.

We spent hours and hours searching for solution and countless emails with
Shopify support. But finally the solution was in one checkbox :slightly_smiling_face: Please
check if in Locations the following checkbox is enabled

[image: image.png]

1 Like