Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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?
Solved! Go to the solution
This is an accepted solution.
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
Hello @upandaway ,
You can use it in cart template a/to your need
{% for tag in item.tags %}
{% if tag contains 'iextra' %}
<!-- Add you line item here -->
{% 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 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!
This is an accepted solution.
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 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.
Hello, I want to add to drawer cart and checkout a product text "This is a Made-by-Request product.
Estimated delivery time: 4 - 6 Weeks" for some product but i dont find a soluction. can you help me?
I want to look like this discount text in my store.
Thank you