All things Shopify and commerce
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
Solved! Go to the solution
This is an accepted solution.
Fantastic! Don't forget to Mark As Solution & Like to make the answer more visible to the community, Cheers!
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!
Works perfectly.
Thank you.
Barry
This is an accepted solution.
Fantastic! Don't forget to Mark As Solution & Like to make the answer more visible to the community, Cheers!
Could you expand on this solution? I'm looking to do the same thing; add a line of text in the product description "This work is currently on exhibit, please contact me for purchase 'link to contact form'" when an artwork in my shop has the tag 'exhibiting'. I have the Studio theme.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024