How to get product tags from a section template?

Topic summary

A developer is experiencing issues accessing product tags within a Shopify section template, questioning if changes in Shop 2.0 have affected the standard approach.

The Problem:

  • Traditional Liquid code for iterating through product.tags and checking if tags contain specific words isn’t working in section templates
  • The developer cannot even display tags using basic syntax
  • Multiple code variations have been attempted without success

Proposed Solutions:

  • One user suggests accessing the parent snippet to retrieve product tag data, providing a working example that checks for a “custom” tag and sets a boolean flag
  • Another user confirms the basic loop structure should work and recommends adding a {% break %} statement when a matching tag value is found to stop further iteration

Status: The discussion remains open with potential workarounds shared but no definitive explanation for why the standard approach fails in section templates.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

I’ve done this a million times over the years, have things changed in shop 2.0?

Basically trying to get / if product tag contains word, do stuff. /

{% for tag in product.tags %}
{% if tag contains 'word' %}
do stuff
{% endif %}
{% endfor %}

Tried a bunch of variations to that with no luck. I can’t even display tags with

{% for tag in product.tags %}{{ tag }}{% endfor %}

from the section template (when viewing a product page)

Any help would be appreciated. Thank you!

For a quick fix, I had to dig up to the parent snippet and to get this going

{% comment %}Check if tag has custom{% endcomment %}
  {% assign hide_stockcheck = false %}
              {% for tag in product.tags %}
                {% if tag contains "custom" %}
                {% assign hide_stockcheck = true %}
                  {% break %}
                {% endif %}
              {% endfor %}
    {% if hide_stockcheck == false %}
       

   {% endif %} 
  {% comment %}END Check if tag has custom{% endcomment %}
{% for tag in product.tags %}
{% if tag contains 'word' %}
do stuff
{% break %}
{% endif %}
{% endfor %}

When the tag is equal to a certain value is out of circulation