I’d like to show a few different messages on my product page using the stock count but I’m afraid my current liquid loop isn’t quite working. I’m sure it’s probably something simple but I can’t figure it out right now. Essentially I’d like to show the following:
More than 5 = Show normal stock count message
More than 1 and 5 or less = Show last few in stock!
Exactly 1 = Show Last one message
Zero = Show out of stock message
Can someone more capable with liquid statements help me sense check what I’ve done wrong here?
The loop I’ve got so far is:
{% comment %} More than 5 in stock {% endcomment %}
{% if current_variant.inventory_quantity > 5 %}
{% if current_variant.available %}
{{ 'products.product.stock_label' | t: count: current_variant.inventory_quantity }}
{% endif %}
{% comment %} Greater than 1 and less than 5 in stock {% endcomment %}
{% elsif current_variant.inventory_quantity > 1 or current_variant.inventory_quantity < 5 %}
{% if current_variant.available %}
Only {{ 'products.product.stock_label' | t: count: current_variant.inventory_quantity }} - Don't miss out!
{% endif %}
{% comment %} If there's only 1 left {% endcomment %}
{% elsif current_variant.inventory_quantity == 1 %}
**Last one in stock** – Act fast!
{% comment %} Otherwise show as out of stock {% endcomment %}
{% else %}
Currently out of stock
{% endif %}
Many thanks