Envy Theme: How to display variant stock levels on product page

Ellie_Grocock
Tourist
4 0 1

I've searched around for answers on this topic for a while now and just can't seem to work it out.

I found the below code which did show how many were in stock but only for the default selected variant.

                     <div id="variant-inventory">
 {% if product.variants.first.inventory_management == "shopify" %}
    {% if product.variants.first.inventory_quantity > 0 %}
       We currently have {{ product.variants.first.inventory_quantity }} in stock.
    {% else %}
       The product is out of stock
    {% endif %}
 {% else %}
    This product is available
 {% endif %}
</div>

Ideally I'd like the stock level to be updated each time a different variant is selected, but I cannot figure out how to make this possible.

The theme I'm using is Envy by WeTheme.

My website is https://millieandjohn.com.

Thank you in advance.

0 Likes
Laurelin
New Member
13 0 0

Hi,

I noticed when looking at your website that you managed to sort this. I also run envy and wondered if you could tell me how you sorted it?

 

thanks

 

laurelin

0 Likes