Shopify themes, liquid, logos, and UX
Hello,
I am trying to us the following code on the cart page to check if a product has a tag, if it does display text, however when I do this and there is more than 1 product in the cart (with different tags) it displays the text for each product.
This is a example of my code:
{% for item in cart.items %} {% if item.product.tags contains 'shiptoday' %} <h1>Ships Today</h1> {% endif %} {% endfor %}
This would be underneath the product title, as a test I have noticed if there is multiple products but none of them contain the product tag then the <h1> tag doesn't show, however if one of the products has the tag, all the products show the <h1> tag.
Am I doing something wrong or misunderstanding how liquid/tags work on the cart page?
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025