How to check for a product tag present in any cart items

I’m seeing this ‘has_preorders’ attribute appearing in orders that do not contain any item tagged with ‘pre-order’.

This code snippet is in ‘cart.liquid’ and is the only code that refers to the ‘has_preorders’ attribute.

{% assign has_preorder = false %}
{% for item in cart.items %}
  {% if item.product.tags contains 'pre-order' %}
    {% assign has_preorder = true %}
  {% endif %}
{% endfor %}
{% if has_preorder %}
  
    
    

This order has a pre-sale item and will ship within 7 days

  

{% endif %}

Can anyone see what I’m doing wrong here?

Did you figure this out? I have a similar problem and yours looked okay to my newb eyes.