How to check product tag match with array value

I want to check if any of my products match a given array value.

Here’s my product tag:

{% assign product_tags = product.tags | split: ',' %}

Here’s my discount code:

{% assign discountCode = "50off, 100off, 150off, 200off, 250off, 300off, 350off, 400off, black_friday_2022" | split: ',' %}

What I have tried with:

{% for tag in product_tags %}
    {% if discountCode contains tag  %} 
         Extra in-Cart Discount
      {% endif %}
{% endfor %}

Any help would be much appreciated

You are doing the right way, but the code need some changes

  1. Remove spaces between discount codes
{% assign discountCode = "50off,100off,150off,200off,250off,300off,350off,400off,black_friday_2022" | split: ',' %}
  1. We should break the loop if the match tag is found
{% for tag in product_tags %}
    {% if discountCode contains tag  %} 
         Extra in-Cart Discount
         {% break %}
      {% endif %}
{% endfor %}

Hope that helps!

Apparently the product_tags isn’t recognized by flow.