Hello, wonderful people!
In the cart there are several products.
Some have the tag ‘extra’.
The products with the ‘extra’ tag should show an extra line of text.
Anyone?
Hello, wonderful people!
In the cart there are several products.
Some have the tag ‘extra’.
The products with the ‘extra’ tag should show an extra line of text.
Anyone?
Hello @upandaway ,
You can use it in cart template a/to your need
{% for tag in item.tags %}
{% if tag contains 'iextra' %}
{% endif %}
{% endfor %}
If you are also looking for cart line item attributes you can check here https://ui-elements-generator.myshopify.com/pages/cart-attribute
Thanks
Hi @upandaway ,
Please add code in {%- for item in cart.items -%}:
{%- assign tags = item.product.tags -%}
{%- assign checkTags = tags | where:‘extra’ -%}
{%- if checkTags != blank -%}
show an extra line of text
{%- endif -%}
Hope it is clear to you.
If you find my answer helpful for you, please mark it as a solution. Thank you and good luck
Hi Guleria, and thank you for your answer.
I’ve tried this, and it did find the tag in question, but it applied it to all the line items regardless if they had the tag or not. Placed it inside {%- for line_item in cart.items -%} block. Am I putting it in the wrong place?
Thank you!
Hi LitExtension, and thank you for you answer.
I’ve tried your code, placed it inside the {%- for line_item in cart.items -%}, where I also did my previous attempts. It doesn’t work, sadly. Both solutions recommended are pretty close to things i already tried. The closest i got was giving all the products in the cart the same line of extra text, regardless of what products contained the tag and not. As long as at least one of them did, everyone got the extra text.
Did you add the ‘extra’ tag to the product? https://i.imgur.com/Tvs9903.png
Please send me the code of cart file, I will check it.