Re: Liquid: check if using cart drawer or page (or popup!)

Solved

Liquid: check if using cart drawer or page (or popup!)

nagumi
Explorer
64 2 30

Hi! We use Dawn (7.0.1). For a bit of custom code I'm writing, I need to detect the ID of the <form id=""> currently active, or detect whether the cart in question is the drawer or the page (or the popup!)

 

Essentially, I need a way to get the current form ID - but I can get this either directly (via some kind of {% current form %}?) or indirectly by knowing which kind of cart is currently in use.

 

Thanks

Accepted Solution (1)

WebDeskSolution
Shopify Partner
176 42 49

This is an accepted solution.

Hello @nagumi 

 

Here is the Liquid code to get cart type in dawn theme. settings.cart_type 

 

HTML/Liquid code to check if it’s drawer

 

{%- if settings.cart_type == "drawer" -%}
   // drawer code
{% endif %}

 

If you find our reply helpful, please hit Like and Mark it as a Solution.

 

An award-winning North American Shopify Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Shopify Partner | Shopify Development Agency | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9

View solution in original post

Replies 2 (2)

WebDeskSolution
Shopify Partner
176 42 49

This is an accepted solution.

Hello @nagumi 

 

Here is the Liquid code to get cart type in dawn theme. settings.cart_type 

 

HTML/Liquid code to check if it’s drawer

 

{%- if settings.cart_type == "drawer" -%}
   // drawer code
{% endif %}

 

If you find our reply helpful, please hit Like and Mark it as a Solution.

 

An award-winning North American Shopify Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Shopify Partner | Shopify Development Agency | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9

raul-vila
Shopify Partner
5 1 1

Hi there, where can I read more about the "settings" object? I'm struggling to find out information about this object and what data is there.

Thanks