Hello, novice here.
For products which have product tags, I want to show the text: “Related keywords: [Tag1], [tag2], [tag3] …”
I’ve managed to get the tags to show up on the product page. However, for products which do not have product tags it just says “Related keywords:”
In Liquid, how do I write an if statement that essentially says “Only show the following if there is a value in the Product Tag field, otherwise show nothing”?
Below is what I have so far. Appreciate your help!
Page with product tags: https://earthtoplanet.com/collections/cartoons/products/abundance-of-caution
Page with no product tags: https://earthtoplanet.com/collections/cartoons/products/pythagoras-shortcut
(Theme: Dawn)
{% if product.tags %}
Related Keywords:
{% for tag in product.tags %}
{{ tag }},
{% unless forloop.last %}
{% endunless %}
{% endfor %}
{% else %}
{% endif %}