How can I display remaining inventory on the Dawn theme?

@spmufflers

Add this code into your product.template.liquid or main-product.liquid where you want to add


{% assign product_qty = 0 %}
{% for variant in product.variants %}
{% if variant.inventory_quantity > 0 %}
{% assign product_qty = product_qty | plus: variant.inventory_quantity %}
{% endif %}
{% endfor %}
{% if product_qty > 0 %}
      

  HURRY!  Selling out fast! Only **{{ product_qty }}** left in stock!

                 
      {% endif %}

Let me know if you need any more help.

Thank you.

1 Like