If at least 1 product has tag show section

Highlighted
New Member
8 0 0

I want to display a button on my cart drawer and a section on my cart page, however im having an issue. When a product with a product.tag of 'Can Be_Gift Boxed' is added to cart I want a button to appear, I'm able to make this happen, however, if there is a product in cart that doesn't have the tag the button doesn't show. I want the button to show if at least 1 product in the cart has the tag, doesn't matter how many don't have the tag if 1 does I want the button to show.

I'm not sure what to add, is there an at least statement or something I can add?

{% for item in cart.items limit:1%}

{% if item.product.tags contains 'Can Be_Gift Boxed' %}
<a href="/cart">
<button type="button" name="cart" href="/cart" class="Button Button--primary Button--full">
<span>Create Your Gift Box</span>
</button>
</a>
{% endif %}

{% endfor %}

0 Likes
Highlighted
Shopify Partner
531 108 129

Hello Alfie,

Your code is working fine.
carttag.PNG

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
0 Likes
New Member
8 0 0

@Guleria 

I am getting it to work if all the products in the cart have the same tag. But if one product doesn't have the tag it doesn't display the button.

Screenshot 2019-10-11 at 14.35.46.pngScreenshot 2019-10-11 at 14.36.02.png

I want if there is at least one product in the cart that has the tag to display the 'Create your gift box' button, currently it only shows it if ALL of the products have the same tag.

0 Likes
Highlighted
Shopify Partner
531 108 129

That's sounds odd, you can check in my screen-shot one product have specific tag and another don't have  and it show option in one product.
If you want, you can drop your store login to me through email so that i can check.
Thanks

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
0 Likes