window.Shoppex).
Script
Integration Modes
- Declarative (Data Attributes)
- Programmatic (JS API)
The SDK auto-binds clickable elements matching:Multi-item via JSON:Group button:
[data-shoppex-product-id][data-shoppex-group-id][data-shoppex-checkout]
Data Attributes
* Required unless
data-shoppex-items contains at least one valid item.
** Required when you want to open a group instead of a product checkout.
data-shoppex-metadata example:
JavaScript API
Shoppex.init(config?)
Initializes bindings and keyboard handlers.
- Usually optional because the script initializes automatically.
- Safe to call multiple times; first call wins.
Shoppex.open(options)
Opens modal checkout.
itemsmust contain at least one validproductId, unlessgroupIdis provided.groupIdopens a group picker first, then forwards the buyer into the normal product checkout page.- If more than one item is passed, current modal flow uses the first valid item.
- Calling
open()while a modal is open closes the old modal first.
Shoppex.close()
Closes the modal programmatically.
Events
Listen ondocument:
Internal iframe events used by the SDK:
shoppex:readyshoppex:resizeshoppex:close
URL Mapping
The SDK resolves checkout iframe URLs to:quantityvariantIdtheme(only when notauto)flowshopIdreturnUrlemailcouponCodeaffiliateCodemetadata[key]=value
Runtime Behavior
- Modal uses Shadow DOM (
mode: closed) for style isolation. Escape, backdrop click, and close button all close modal.- Dynamically inserted buttons are auto-bound (MutationObserver).
- Message handling only accepts trusted checkout origins.
Practical Example
Need Faster Setup?
Copy/Paste Snippets
Framework snippets for Next.js, React, WordPress, and Webflow.