How to show different stock levels for different variants?

New Member
1 0 0

I'm trying to display different stock levels (low stock, x in stock, out of stock) for different variants. Currently I have it so that it displays the stock for one variant, but I want to display it for all variants of a single product. 

 

 

<div>
     {% if product.selected_variant.inventory_management == "shopify" %}
     {% if product.selected_variant.inventory_quantity == 0 %}
           Out of stock!
     {% elsif product.selected_variant.inventory_quantity < 5 %}
           Only {{ product.selected_variant.inventory_quantity }} left in stock!
     {% elsif product.selected_variant.inventory_quantity < 15 %}
           Low stock!
     {% endif %}
     {% endif %}               
</div>

 

 

0 Likes