Difference in inventory quantity between Shopify Editor and live version

Difference in inventory quantity between Shopify Editor and live version

Mark04
New Member
13 0 0

Hi,

 

I'm working on custom code to display the inventory status of each product on the product page and on the collection page (in stock, available for back-order, out of stock, etc.). This works, except for products that are bundled with the Shopify Bundles app. It does not display the correct status, because product.selected_or_first_available_variant.inventory_quantity is always 0 on these products for some reason.

 

When viewing our site through the Shopify Editor (exact same version as the live site), everything works fine and the inventory quantities and status are correct. I really have no idea why this only works when viewing through the Shopify Editor.

 

When console logging product.selected_or_first_available_variant.inventory_quantity on the live site, we get this for bundled products:

Scherm­afbeelding 2025-01-21 om 15.56.12.png

 

In the shopify editor, we get this for bundled products which is correct: 

Scherm­afbeelding 2025-01-21 om 15.55.17.png

 

 

Could anyone explain to me what causes this and how to fix this? I really have no idea and have been stuck on this issue for a week now.

Replies 0 (0)