Assign new product tag to another product tag using Liquid snippets

Solved
Highlighted
Excursionist
37 0 1

Hello,

 

Short: I need to assign additional product.tags based on current product.tags. For eg: Products 1 through 100 contain the product tag "1234". I want to be able to add additional tags using liquid snippets. I'm using Debut Theme.

 

Long: I have a large number of products that will have a base "tag" that contains an ID like "1234" I want to be able to add additional product tags to ALL products that contain the tag "1234". I think the best course for me would be to use snippets, but I don't know where to include the snippet. I'm using Debut Theme.

 

Eg: I create a snippet called "Snippet_1" that contains:

{% if product.tags contains '1234' %}
{% assign product.tags = "red" %}
{% assign product.tags = "orange" %}
{% assign product.tags = "green" %}
{% endif %}

 

Then I put this snippet somewhere for the product.

{% include 'Snippet_1' %}

If this is an adequate course of action, where do I put this snippet? In product.liquid? product.card.list/grid? product.template.liquid? Can you help me get my code to work?

 

For anyone curious this is the closest related post I've found but it is unsolved.

 

Thank you!

0 Likes

Success.

Shopify Expert
2653 60 650

You can't change this data from the theme, that's why there is no answer -- you'd need an App for this. SmartTags is probably the closest match. For more complex rules you'd need to look at Mechanic, Arigato or custom App.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
1 Like