Hype Cart

Open the cart drawer with JavaScript

Updated Sep 21, 20261 min read

Dispatch hype:cart:open from your storefront JavaScript to open Hype Cart Drawer:

document.dispatchEvent(new CustomEvent('hype:cart:open'))

You can use this in a custom button's click handler or another storefront integration. Dispatching on window also works:

window.dispatchEvent(new CustomEvent('hype:cart:open'))

No event detail is required. If the drawer is already open, it stays open.

Before you use the event

  1. Activate a cart in Hype Cart Drawer.
  2. Enable and save the Hype: Cart Drawer app embed in your theme.
  3. Dispatch the event after the cart embed has initialized on the storefront.

The event works even when automatic opening and cart-link interception are disabled. It opens the drawer without adding products or changing quantities.

Events sent before the embed initializes are not queued. If no cart drawer is loaded on the page, the event has no effect. Run it on the storefront, not in Shopify admin.

Related articles

Still need help?

Start a chat and we'll pick it up right here.