Skip to content

Instantly share code, notes, and snippets.

@CodeBrotha
Created August 12, 2022 00:23
Show Gist options
  • Save CodeBrotha/044016f7ad3e2bf689e4029fc3c78b55 to your computer and use it in GitHub Desktop.
Save CodeBrotha/044016f7ad3e2bf689e4029fc3c78b55 to your computer and use it in GitHub Desktop.
Shopify Liquid - Check if product contains any of a given list of tags
{% assign excludedTags = "some-tag,some-other-tag,another-tag,yet-another-tag" | split :',' %}
{% assign hasExcludedTag = false %}
{% for tag in excludedTags %}
{% if product.tags contains tag %}
{% assign hasExcludedTag = true %}
{% break %}
{% endif %}
{% endfor %}
{% comment %} EXAMPLE USAGE: {% endcomment %}
{% unless hasExcludedTag %}
{% include 'all-the-things' %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment