How can I modify inventory code to show only for 'Reduced' items?

Hi, I am currently using the code below to show my stock levels. I want to change it to only show on items that has reduced in the title. I have tried adding in “if product.title contains ‘Reduced’” etc in several places but I can’t get it working. Thanks


{% if product.variants.first.inventory_management == "shopify" and product.variants.first.inventory_quantity > 0 %}
Hurry only {{ product.variants.first.inventory_quantity }} in stock!
{% endif %}

Hi @Claire_Brennan ,

Please change code:

{% if product.title contains 'reduced' %}
        
          {% if product.variants.first.inventory_management == "shopify" and product.variants.first.inventory_quantity > 0 %}
          Hurry only {{ product.variants.first.inventory_quantity }} in stock!
          {% endif %}
        

{% endif %}

Hope it helps!

Perfect, thank you! I think I tried that line of code everywhere except right at the beginning!

Hi

I would like to be tweaked further if possible.

I have a product listing with multiple variants. Currently the code below makes it seem as if 0 are in stock if the first variant is out of stock. Is there a way to tweak the code per variant?

{% if product.variants.first.inventory_quantity < 5 %}

We have {{ product.variants.first.inventory_quantity }} item(s) remaining


{% endif %}