To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more

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

Solved
nagumi
Explorer
62 2 23

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)

Accepted Solutions
WebDeskSolution
Shopify Partner
109 30 23

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 | Hire Us | Call Us 877.536.3789


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

View solution in original post

Reply 1 (1)
WebDeskSolution
Shopify Partner
109 30 23

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 | Hire Us | Call Us 877.536.3789


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