Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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:
In the shopify editor, we get this for bundled products which is correct:
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.
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025