Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi Shopify fam!
Looking for some help here 🙂
I'm trying to code a simple condition for product tags. If the product tag is in the cart, do something.
I added the code in the cart-item snippet file on lines 112-114:
However, I realized that when the snippet is rendered, my code is not executing. Cart-item is being rendered into the main-cart file:
What should I add or change so that the condition works when rendered? Thanks in advance!
Solved! Go to the solution
This is an accepted solution.
@SomeUsernameHe Thanks for your help, unfortunately, it didn't work either.
Capitalization matters with tags. Can I see the tag you add to the product?
@SomeUsernameHe , sure, the tag's text was copied and pasted so it can't be wrong.
I believe the issue is related to how the snippet renders. When I copy all of the code from the cart-item snippet and paste it where it's supposed to render, then it works. But I would like to know how to make it work through the render.
Try inserting
{% for item in cart.items %}
before
{% if item.product.tags ... %}
and then insert
{% endfor %}
after the
{% endif %}
This is an accepted solution.
@SomeUsernameHe Thanks for your help, unfortunately, it didn't work either.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025