If you'd to show some HTML content on a Shopify product page ONLY if the product has a specific tag, the following is the trick that will help you (hopefully!).
My use case: In one of my Shopify stores, I wanted to automatically show a different set of Frequently Asked Questions and Testimonials for each type of product I had. To accomplish this, I decided to tag each piece of content with the type of product it was. Then I wrote up some simple HTML to display for each product type. Then, I inserted the following for/if statement into the product-template.liquid:
{% for tag in product.tags %}
{% if tag contains 'insert your tag here between the apostrophes' %}
<!-- replace this line with html content -->
{% endif %}
{% endfor %}
I inserted several of the for/if statements for each product type.
Note that the tag is case sensitive -- if the tag is lowercase in the if statement above, it must be lowercase in your Shopify product tag as well.
Shout out to Steven10 for providing the solution above. I'm always impressed and grateful when people spend their time helping others with weird programming thing.
Add new comment