How can I manage gift options based on product tags?

Hi,

PFA

I want to hide gift options in the cart page when product is tagged with nogiftwrap and I want to show it when product is tagged with giftwrap

store url: https://ncytest.myshopify.com/

And need a icon next to the product in the cart page .

Hi @rajeshNekkanti ,

Go to sections > main-cart-items.liquid file, in line 67 add code:

{%- if item.product.tags contains 'giftwrap ’ -%}
show icon
{%- endif -%}

you can add HTML to display the icon for it.

Hope it helps!

Hi @rajeshNekkanti ,

Do you want to show or hide this?

First, you need to add assign at line 45:

Code: {%- assign checkgift = false -%}

Then you change the code:

{%- if item.product.tags contains 'giftwrap ’ -%}
{%- assign checkgift = true -%}
{%- endif -%}

Now you just need to add code to display html div GIFT OPTIONS:

{%- if checkgift == true -%}

{%- endif -%}

Hope it is clear to you.

Hi @brayanweldir ,

You can create a question on the community and send me the link. I will check it.
Because this will help build a better community.
Thank you.