Liquid validation based on any single element from 1 array matching any single elements from another

Solved
khard
Excursionist
14 1 3

I have 2 arrays and I want to validated if any element in array1 equals any element in array 2. 

Specifically, if any customer tags equals any tags in list of tags held in comma separated metafield.

Accepted Solution (1)

Accepted Solutions
iDoThemes
Trailblazer
197 42 72

This is an accepted solution.

You should only need to loop through the customer tags, and check if the metafield contains the tag:

 

    {% for tag in customer.tags %}
      {% if your.metafield contains tag %}
          <!--   	Do stuff	 -->
      {% endif %}
    {% endfor %}

 

Developer of Liquify Chrome Extension -- Enhance the Shopify Theme Code Editor
.




Theme Developer -- Drop me a line

View solution in original post

Replies 2 (2)
iDoThemes
Trailblazer
197 42 72

This is an accepted solution.

You should only need to loop through the customer tags, and check if the metafield contains the tag:

 

    {% for tag in customer.tags %}
      {% if your.metafield contains tag %}
          <!--   	Do stuff	 -->
      {% endif %}
    {% endfor %}

 

Developer of Liquify Chrome Extension -- Enhance the Shopify Theme Code Editor
.




Theme Developer -- Drop me a line
khard
Excursionist
14 1 3