Adding specific tag with prefix to cart page

Solved
alxandrws
New Member
4 0 0

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.

0 Likes
alxandrws
New Member
4 0 0

Is anyone able to help me?

I'm happy to explain further my requirements if I haven't been clear enough.

Thanks.

0 Likes
IttantaTech
Shopify Partner
485 52 87

Hello , @alxandrws 

Do you want to display the product tags on cart page ? 

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
0 Likes
alxandrws
New Member
4 0 0

Yes on the cart next to the can size as below:

alxandrws_0-1632644175115.png

I only want to display specific tags though and remove the prefixes as described in my original message.

Many thanks.

 

0 Likes
IttantaTech
Shopify Partner
485 52 87

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 %}

Thanks,
Ittanta Technologies Pvt. Ltd. | Shopify Expert
If reply is helpful, please Like and Accept Solution.
To hire us, contact us at info@ittanta.com
0 Likes
alxandrws
New Member
4 0 0

Thank you! That worked, I just tweaked a bit to get desired result.

 {% for tag in item.product.tags %}
 
 {% if tag contains 'BT!' %}
 
     <small>{{tag | split:'!' | last}}</small>
 
 {% endif %}
 
 {% endfor %}
0 Likes