Check if SKU has a tag

Tag with name

You can map a list of tag_names using list_unique

1
2
3
4
{% assign tag_names = sku.tags | list_unique: 'name' %}
{% if tag_names contains 'Deklaration' %}
  <div>Denne vareart har Deklaration som tag.</div>
{% endif %}

Tag with id

1
2
3
4
{% assign tag_ids = sku.tags | list_unique: 'id' %}
{% if tag_ids contains '6c8d4678-2d15-4087-9c8b-6ebd8bf97b89' %}
  <div>Denne vareart har et tag med en bestemt id.</div>
{% endif %}