Hello guys
I got this code to display the available quantity for my products, i have 2 variants in my products (color, size) and i know it’s difficult to fix the code of multiple variants, but at least want just to display “last piece available” when there is 1 piece left. Thanks in advance.
{% 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 %}
There are **{{ product_qty }}** units left in stock.
{% endif %}