Display Variant quantity

Topic summary

Displaying per-variant stock next to size options in Dawn 15’s product-variant-options.liquid.

  • Initial attempt filtered variants with Liquid: product.variants | where: ‘option2’, value | first, then used matching_variant.inventory_quantity. This only returned the first color’s inventory and didn’t change when selecting another color.

  • Solution provided: in product-variant-options.liquid, access each option value’s linked variant with {{ value.variant.inventory_quantity }}. This correctly shows the stock quantity beside each listed size. Outcome confirmed as working.

  • Follow-up request: show only available sizes for the selected color, hiding sizes that don’t exist (not just marking them out of stock). Current behavior lists all sizes across colors, with missing ones shown as out of stock.

  • Status: Unresolved for filtering options; helper requested the product link to diagnose, but the store is a secret/local CLI project, limiting further review.

  • Notes: Code snippet is central; a screenshot was referenced. Key terms: variant (specific option combination, e.g., color+size), option.values (list of choices for an option), inventory_quantity (stock count on a variant).

Summarized with AI on December 13. AI used: gpt-5.

How do I display each variants quantity inside the product-variant-option.liquid?

Tried pretty much any combo I could think of, but not getting any values…
Need the quantity of each listed variant (for size) so I can display it next to each size

Hi @Zeuligan ,

Please send the website link, I will check it for you

Hi @Zeuligan

Can you share you store URL and Password if it password protected so I can check and try to help you out

@Zeuligan

Please share with me your store URL and show me specifically which place do you want to add the feature

Best,

Daisy

I can’t share anything, its both a secret project and mostly it’s a local CLI environment. It’s Dawn 15 and it’s in the product-variant-option.liquid. Basically next to each size I want to display that variants stock levels.

I’m closer, but not solved.

{% assign matching_variant = product.variants | where: ‘option2’, value | first %}
That gives me access to variant stock with for example
matching_variant.inventory_quantity

Problem is that this is for the first variant only (if I got 2 colors the inventory quantity is only for the first color/variant, even if I choose 2nd color/variant).
Anyone got any smart input?

Not sure if this makes it clear but the block “Inventory Status” is what I’m trying to implement PER variant, not one value displayed for the selected variant, but for all LISTED variants that are size (option 2). So I can display available stock in a list next to corresponding size value.

Hi @Zeuligan ,

You can use the following for the product-variant-options.liquid file:

Code:

{{ value.variant.inventory_quantity }}
2 Likes

THANK YOU SIR :heart_eyes: I’m so grateful. Works like a charm :slightly_smiling_face:

You again, thats 2 times you helped me. Thank you!
Do you know if there is a way to show only the available variant options when the

{%- for value in option.values -%} loop?

For my test product I got 2 colors and 6 sizes for color 1 and 7 sizes for color 2 (I deliberately deleted one size, rather than stock 0)
Now matter how I do, both variants list 7 sizes, with the only difference that for color 1, the 7th size is listed as out of stock.
Can you delist the actual variant size if it’s not avaiable? Ofc I could just set that variant size to 0, but was curious if it’s possible without rewriting the entire loop.

Hi @Zeuligan ,

Please send me the product link describing this, I will check it out