Shopify Dawn Theme Disable Cart Drawer Open on Add to Cart

December 5th, 2022





If you want to install a different app for, say, a slideout cart, you may want to disable the inbuilt one on Dawn.

This post details Dawn 7.0.1, but it should work on 7.0.0+ as well as in earlier versions.

There are two places where the call to open() is run, depending on what type of cart you are using.

Drawer Cart

For the new Drawer cart type introduced in Dawn 6.0.0, head to assets/cart-drawer.js.

In the renderContents function, head to the bottom and comment out the this.open() line.

The renderContents function in cart-drawer.js

This line should be found around line 74.

Other Cart

For other cart types, head to assets/cart-notification.js and head to line 41.

Directly underneath if (this.header) this.header.reveal(); comment out the line:

this.open();

The renderContents function in cart-notification.js


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *