Line Item Product Tags in cart - Showtime Theme

Hi all,

Hoping someone can point me in the right direction.

I am trying to display ‘Final Sale’ on each product in the cart that is tagged as ‘Final Sale’ (or ‘On Clearance’). I can get both the native cart and the menu cart to display the message on a page refresh, but not immediately upon placing an item in the cart. And the message disappears as soon as a change is made to the cart - items added or removed. I’ve attached the code I’m using below (which works perfectly in the Debut theme).

Before I need to go to the theme developer, any help or advice would be appreciated - thanks!


{% assign isFinalSale = false %}
{% for item in cart.items %}
{% if item.product.tags contains 'Final Sale' or item.product.tags contains 'On Clearance' %}
{% assign isFinalSale = true %}
{% endif %}
{% endfor %}
{% if isFinalSale %}

**Final Sale** - No Returns/Exchanges

{% endif %}

Tags are not available via ajax as they are considered private. It’s likely your ajax update cart javascript wipes the existing cart when it does it’s update process, so this liquid code won’t be factored in.

1 Like

Thanks!

I was starting to look at the ajax and work out how it calls up the variables, because I didn’t understand. This would definitely make sense given what I’m seeing. I appreciate your taking the time.

Hi @Happy-Camper ,

Because when add, remove or update, it will automatically reload the cart page with ajax, so the edit code will not be displayed, you need to edit the JS file.

Go to ajaxify-shop.js file and edit here. It will require you to have experience in JS coding, so it will be difficult for someone to guide you.

You need to hire expert for it, you can check at: https://community.shopify.com/c/Shopify-Ecommerce-Jobs/bd-p/shopify-job-board

Hope it helps!

If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck.

1 Like

Thanks for the info.