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

brett20
New Member
8 0 0

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 %}
  <div class="five columns offset-by-one">
    <input type="hidden" name="attributes[has_preorder]" value="true" />
    <p>This order has a pre-sale item and will ship within 7 days</p>
  </div>
{% endif %}

Can anyone see what I'm doing wrong here?

0 Likes