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.
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 bothdocument 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 onshopify: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: