Search code examples
shopifysmarty

Shopify If Tag does not contain


What's the opposite of contains in Shopify Liquid Smarty tags?

I basically want to hide products from Search page that has the tag hideme

Example code : {% if product.tags contains 'hideme' %}. In this I want to use does not contain instead of contains


Solution

  • The opposite of {% if %} is {% unless %} so your code would change to:

    {% unless product.tags contains 'hideme' %}
         <blinky> stuff mmm good for cookie monster </blinky>
    {% endunless %}