API custom events

We do not support code customizations. This guide offers a basic reference for developers. Always test code changes on a duplicated, unpublished version of your theme. For assistance, we recommend finding a professional developer through Shopify Experts.

We built an event-based API so developers can easily hook into Flash Cart and add their own functionality. Events are an easy mechanism for apps to talk to each other. Below you’ll find trigger events to make Flash Cart take an action, and events emitted by Flash Cart that your app can receive.

Trigger events

These events can be emitted programmatically to trigger Flash Cart to take an action.

Here’s an example call that uses the Refresh cart event.

const myRefreshEvent = new Event('obsidian:upsell:refresh')
document.dispatchEvent(myRefreshEvent)

Close cart

// This event closes the cart
obsidian:upsell:close

Open cart

// This event opens the cart
obsidian:upsell:open

Refresh cart

// This event refreshes the cart
obsidian:upsell:refresh

Rebind actions on cart

// This event rebinds actions on cart, if changed externally
obsidian:upsell:rebind

Emitted events

These events are emitted by Flash Cart when something occurs.

Cart initialized

// Emitted on completion of initialization of the cart
obsidian:upsell:initialized

Cart updated

// Emitted when cart is updated
obsidian:upsell:updated

Cart opening

// Emitted when cart is instructed to open, but has not finished
obsidian:upsell:opening

Cart opened

// Emitted when cart is opened
obsidian:upsell:opened

Cart closing

// Emitted when cart is instructed to close, but has not finished
obsidian:upsell:closing

Cart closed

// Emitted when cart is closed
obsidian:upsell:closed

Product added to cart

// Emitted when product added to cart
obsidian:upsell:added

Product quantity updated

// Emitted when quantity of a product in cart is changed
obsidian:upsell:quantity

Upsell data updated

// Emitted when the upsells data changes 
obsidian:upsell:upsells:update

Last updated