How do I concatenate a string variable in a loop?

cf65
Shopify Partner
4 0 0

Hi There,

I'm trying to create a variable and depending on the condition, assign and concatenate various string slogans. Here's what I have so far in liquid – unfortunately, it's not working but I'm hoping someone can guide me to get the code below to work properly.

Much appreciated in advance!

Best,
CF.

 

  	{% for tagID in product.tags %}
  		{% assign cf_tag_name = '' %}
  
      {% if tagID contains 'deal' %}
      	{% cf_tag_name = 'Awesome Buy' %}
      {% endif % }
      
      {% if tagID contains 'eggs' %}
      	{% cf_tag_name = cf_tag_name | append: ' +  Free Range' %} 
      {% endif % }
         
      <div class="product-tag product-tag--absolute" aria-hidden="true">
        {{ cf_tag_name }}
      </div>
      
    {% endfor %}

 

 

Replies 0 (0)