For the Brooklyn theme, how do I call the close cart function?

12 1 2

Brooklyn theme has a slide-out cart and in the slide-out is a "check out button" 

I added a button right above checkout "continue shopping" and i want to make that button close the cart instead of the x in the corner.

Shopify Partner
2144 316 852

This is an accepted solution.

I couldn't track down the function that runs the drawer, but you could just add an event listener to your Continue Shopping button and listen for a click, then when that's clicked, run a function that click's the cart button again which will trigger the cart to close. Let's just assume that your continue shopping button has a class of "continue-shopping":


let cart_button = document.querySelector('.cart-link');
let shop_button = document.querySelector('.continue-shopping');

shop_button.addEventListener('click', function(){;



If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
12 1 2

This works! Thanks!

What I did was just this, and I called the function with an inline onclick event. One small change I had to make with yours was that the exit button element is not loaded in until the menu was opened. 

var closeButton = document.getElementById("cartIcon");
function continueOrdering(){;

I must have misunderstood at first because this did not work and I spent hours trying other things. I almost had it on my own changing the class names to open and close the cart but I started having troubles when the css would transition.