Skip to main content
The storefront scripts expose a set of window globals and dispatch DOM events. Use them to react to wishlist changes, to re-scan the page after your theme updates it with AJAX, and to debug placement.
Only the globals and events listed here are meant for theme developers. Other window.cb* names are internal and can change between releases.

Events

cb:wishlists-changed

Dispatched on document whenever a wishlist is created, renamed or deleted, or when an item is added or removed.

cb:variant-changed

Dispatched when the app sees a variant change on a product page or inside a product card.
The app learns about variant changes from the theme’s variant:changed event and from the URL’s ?variant= parameter. If your theme changes variants without either, dispatch variant:changed yourself:

cb:wishlist-view-changed

Dispatched by the wishlist page when it switches between a list and a wishlist’s detail view. detail.wishlistId holds the open wishlist ID.

Cart events

After a shopper adds a product to the cart from the wishlist page, the app dispatches these events on both document and window, with detail: { cart, source: 'cb-wishlist' }: cart:refresh, cart:updated, cart:build, cart:change, cart:open, cart-drawer:open, drawer:open On Dawn-based themes it also publishes PUB_SUB_EVENTS.cartUpdate. Listen to whichever event your theme’s cart drawer understands.

Re-scanning after AJAX updates

The app watches the DOM and rescans on shopify:facet:changed, shopify:section:load and popstate. If your theme loads products in a way the app misses (custom infinite scroll, a quick-view built from scratch), trigger a rescan yourself:

Useful globals

Identity and settings

Wishlist mode and guests

UI helpers

Debugging

Run these in the browser console on your storefront:

Storage the app uses