Display variant inventory quantity on product page (Minimal theme)

I placed it just after:

{{ 'products.product.quantity' | t }}

Thank you very much for helping.

Kind of you.

Before I do this I just want to make sure this code change will show a
quantity in stock for each product in a dropdown box of variants.

Thanks Again.Mike

Thank you very much for helping. Kind of you.

Before I do this I just want to make sure this code change will show a quantity in stock for each product in a drop down box of variants.

Thanks Again…Mike

It does for me but you will really need to test it.

My code is just a bit different btw.

{% if variant.inventory_management == "shopify" and variant.inventory_quantity < 3 %} Only {{ variant.inventory_quantity }} available. {% else %} {% endif %}

@JET0403

This just makes all the available quantities show up and doesn’t differentiate by size.

@Smeelah This shows up but it doesn’t change the quantity number when I select different size variants. I tested it on a product that had a different number of each size, one of them being sold out, and they all just said “2 available”

Was anyone able to figure out how to get each size/variant to display the correct stock amount?

I have tried every solution here :confused:

@EKeating

I used this code and followed all directions, however, the inventory doesn’t change when variant changes. For instance, if I have 3 large shirts and 2 small, the amount available doesn’t change between them. It stays at 2 available. Can you help me?

Hi @EKeating , have you seen the accepted solution posted 11-21-2020 03:55 PM ?

Look also to the “context” differences (11-21-2020 04:37 PM) in case your code is different.

And to the correction of quanrtity, it should be quantity ( 11-22-2020 11:49 AM)