Personalized checkout and custom promotions with Shopify Scripts
Hello, I'm trying to put a code into a confirmation mail. Below the title of the product that is ordered it should show the SKU, but only for certain products with certain tags (men, women and unisex)
So this is what I wrote:
{% if product.tag contains 'men, women, unisex' %}
<p class="text-center uppercase">SKU: {{ line.variant.sku }}</p>
{% endif %}
However, it doesn't work.
Does anyone know what I'm doing wrong?
Kind regards,
Thomas
This {% if product.tag contains 'men, women, unisex' %} will only try to match a tag against that singular product.tag with the exact text of "men, women, unisex" which isn't possible as commas are disallowed within a tags.
If "men, women, unisex" is mean to be individual tags then you need to match each individual tag.
Noting inconsistent use of uppercase/lowercase etc can cause inconsistent results.
And that "men" is ambiguous as it will match the text in both "men" and "women" so you may need to do exact string comparisons for each tag instead of using contains.
{% assign normalized_product_tag = product.tag | downcase %}
{% if normalized_product_tag contains 'men' or contains 'women' or contains 'unisex' %}
If your not looping over product.tags (plural) instead of product.tag (singular) you need to use product.tags
{% assign normalized_product_tags = product.tags | join:", " | downcase %}
{% if normalized_product_tags contains 'men' or contains 'women' or contains 'unisex' %}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025