Check for value of product title in cart drawer

Check for value of product title in cart drawer

DutchDelight
Excursionist
41 0 8

Currently using Envy theme and in the cart-drawer I want to do something depending on the contents of the product title.

The file is cart-drawer.liquid, but I can't figure out how to get the title (or price) of the current product that's being displayed.

 

Does anyone know how to get this information?

 

It normally uses the regular cart fields, like cart.items_subtotal_price but I need to check it for the current item in the cart.

I've tried cart.items.line_item.product.title for example, but whatever I try to come up with, it never returns a value...

Reply 1 (1)

gr_trading
Shopify Partner
2040 149 206

Hi @DutchDelight ,

 

Find the code below

 

{%- for item in cart.items -%}

 

then use the below code inside the loop to get the product title

item.product.title

 

Hope this will help...

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee