Add Text line to any product that has a specific tag.

Solved
TheFunkyTeapot
New Member
3 0 0

Hi, all you clever people. I am sure this is an easy few lines of code! I know I could do what I want by adding this to each and every product description text, but I think a few lines of code will do it universally and quicker?

Is there a variable that can be used to check the "Tags" of a product? Something like?

{% if current_variant.inventory_TAG == "Bisque" %}
Please Note: - This item will need to be returned and fired
{% if current_variant.inventory_TAG == "Cast" %}

This item will require a 45 minute appointment. Please call to book

{%Else %}

Add Nothing
{% endif %}

So I want to add a line of text to all products, but changes depending if the product has a specific Tag.

If Product Tag list includes "Bisque" then show " Please Note: - This item will need to be returned and fired"

If Product Tag list includes "Cast" then show "This item will require a 45 minute appointment. Please call to book"

If Product Tag list include "WOW" then show "This item can be completed without visiting us"

etc

Hope that makes sense,

Thanks Barry

 

 

0 Likes
JHKCreate
Shopify Partner
2042 331 444

Hi @TheFunkyTeapot ,

This is the code for the tag logic:

{% assign productTags = product.tags | join:',' %}

{% if productTags contains "Your_Tag" %}

{%endif%}

 

Let me know if that works for you!

- Did we solve your issue? Like & Mark As Solution to help the community
- Should you need any direct help: contact@jhkcreate.com
0 Likes
TheFunkyTeapot
New Member
3 0 0

Works perfectly.

Thank you.

Barry

0 Likes
JHKCreate
Shopify Partner
2042 331 444

This is an accepted solution.

Fantastic! Don't forget to Mark As Solution & Like to make the answer more visible to the community, Cheers!

- Did we solve your issue? Like & Mark As Solution to help the community
- Should you need any direct help: contact@jhkcreate.com