Add an "clear the cart"-button to the cart page on Dawn theme

Topic summary

A user seeks code to add a “clear cart” button to Shopify’s Dawn theme without using third-party apps.

Solution Provided:
Another user shares a simple code snippet:

<a href="/cart/clear">Clear cart</a>

Implementation Details:

  • For Dawn theme: Add the code to the cart-drawer.liquid snippet (not the section file)
  • For Refresh theme (Dawn-based): Successfully placed on line 29 of main-cart-items.liquid for the main cart page
  • The drawer/sidebar cart requires placement in the snippet file specifically

Key Points:

  • The solution works across Dawn-based themes
  • Placement location matters: snippets vs. section files produce different results
  • One user confirms the code worked quickly and simply
  • Discussion includes troubleshooting for proper button positioning, particularly above the checkout button in the cart drawer
Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Does anyone have a code example to add an “empty the cart” or “clear the cart”-button to the Dawn theme, so that one can delete all items with one click.

I know Apps exists, but using several apps already I rather find a code solution.

Thanks,
Karin

Hello @karinorage ,

Use this

Clear cart

Thanks

2 Likes

Thank you, Guleria.

That was quick and simple :+1:

1 Like

Hi,

I have the same issue on the “refresh” theme. Would this work there also, and where whould I paste it?

thanks

I think it would, Refresh is a Shopify theme, based on Dawn. I see in the demo it uses a drawer, so you might want look into the cart-drawer.liquid to add the

Clear cart

in to.

tx for responding, but it dit not work putting it into cart-drawer.liquid.

I tried like this

and like this:

Hi,

I managed to get the button on the main overview for the cart by pasting it on line 29 in main-cart-items.liquid

However for the side bar there is no effect. That’s the most important place to have it I think

You must not put it in the section cart-drawer.liquid, but in the snippet: cart-drawer.liquid

You must not put it in the section cart-drawer.liquid, but in the snippet cart-drawer.liquid

Ahh I see, and if I want it just above the ckeckout button, where would I put it?

on point! Thanks