Ad

Shopify If Tag Does Not Contain

- 1 answer

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

Ad

Answer

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 %}
Ad
source: stackoverflow.com
Ad