Showing correct variant quantity

Topic summary

A user is experiencing an issue where their product page always displays the inventory quantity of the variant with the highest stock, rather than updating to show the currently selected variant’s quantity. For example, when a variant with 0 stock is selected, the page incorrectly shows a higher number.

Proposed Solutions:

  • Review how the current setup fetches inventory data and modify it to pull stock levels for the selected variant
  • Implement JavaScript updates to dynamically reflect the selected variant’s inventory
  • Modify variant options to include proper inventory data
  • Alternatively, create a custom Shopify app using GraphQL calls to fetch and display correct variant inventory dynamically

The issue appears to stem from the product template not properly updating inventory information when variant selections change. The discussion remains open with the original poster yet to indicate their preferred solution approach.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hello,

I need some help displaying the correct inventory quantity for variants. The quantity shown is always the quantity of the variant with the most in stock. I need it to show the quantity of the selected variant.

In the example above, it should say “We have 0 in stock”

Any help would be appreciated

Hi @davidre ,

Thanks for reaching out!

We understand the issue — it looks like the inventory quantity being displayed is always that of the variant with the highest stock, rather than the currently selected variant.

To resolve this, we’ll first need to review how your current setup is fetching the inventory data. If it’s possible to tweak it to pull the stock level of the selected variant instead, we can make that change directly.

If not, we can help set up a custom or private Shopify app that makes GraphQL calls to fetch the correct variant inventory dynamically and update the display accordingly.

We’d love to help you get this sorted! Let us know how you’d like to proceed, and we can take it from there.

Best,
Shubham | Untechnickle

Hi @davidre

This issue typically occurs when the product page fails to dynamically update the inventory based on the selected variant. To resolve this, ensure that the product template includes the appropriate JavaScript to display the correct stock quantity for the chosen variant.

Need to Update JavaScript to dynamically reflect the selected variant’s inventory and Modify Variant Options to include inventory data, ensuring accurate stock display.

Let me know if you need detailed assistance.