Using "unless" on cart

New Member
5 0 0

I am trying to add cross-sell images on the checkout. I would like to show a certain image if a certain product isn't in the cart. I have this code:

 

{% for item in cart.items %}
{% unless item.product.tags contains 'tagone' %}
{% include 'tag2image' %}
{% endunless %}
{% unless item.product.tags contains 'tagtwo' %}
{% include 'tag1image' %}
{% endunless %}
{% endfor %}

 

It works fine until the customer adds the products to the cart.

For example: if you add a product that has a tag of "tagone", then go to the cart, "tag2image" shows up, perfect. If you add the product that has a tag of "tagtwo", both images show up. They should go away.

 

Any help would be greatly appreciated.

0 Likes