Check for value of product title in cart drawer

DutchDelight
Excursionist
18 0 3

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
1589 138 170

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: gr.trading15@gmail.com for quick consultation. | YouTube Videos
To support Buy Me a Coffee