Liquid, JavaScript, themes, sales channels
I want to add specific tags to my cart page that contain a prefix.
For example the prefix is 'BT!' and the tag might be 'BT!IPA' or 'BT!Stout'.
How can I display the tag 'IPA' removing 'BT!' or 'Stout' removing 'BT!' to the cart page?
I am using the minimal theme. My site is www.craftlinebeers.com.
Any help would be greatly appreciated. Thanks.
Solved! Go to the solution
This is an accepted solution.
Hello ,
You can add code like this anywhere inside cart items for loop.
Something like this:-
{% for item in cart.items %}
{% for tag in item.product.tags %}
{% if tag contains 'BT!' %}
<span>Tag = {{tag | split:'!' | last}}</span>
{% endif %}
{% endfor %}
{% endfor %}
Is anyone able to help me?
I'm happy to explain further my requirements if I haven't been clear enough.
Thanks.
Hello , @alxandrws
Do you want to display the product tags on cart page ?
Yes on the cart next to the can size as below:
I only want to display specific tags though and remove the prefixes as described in my original message.
Many thanks.
This is an accepted solution.
Hello ,
You can add code like this anywhere inside cart items for loop.
Something like this:-
{% for item in cart.items %}
{% for tag in item.product.tags %}
{% if tag contains 'BT!' %}
<span>Tag = {{tag | split:'!' | last}}</span>
{% endif %}
{% endfor %}
{% endfor %}
Thank you! That worked, I just tweaked a bit to get desired result.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024