Runtime And SDK
Themes use the Shoppex SDK to load storefront data and drive cart + checkout behavior. There are two common ways to use the SDK in a theme:- CDN (global): load the SDK with a
<script>tag, then usewindow.shoppex - npm: install
@shoppexio/storefrontand import it
Even if your theme runs on localhost, you can still fetch data from the public API by setting
VITE_API_BASE_URL=https://api.shoppex.io.CDN vs npm
SDK Init
Fetch Storefront Data (Store + Products + Groups)
Product Image URLs
Storefront product payloads now expose two primary image fields for different UI surfaces:cdn_image_urlfor cards, listings, search results, cart rows, and other compact UIdetail_image_urlfor product detail pages, galleries, and zoom
- product grid card ->
product.cdn_image_url - PDP hero image ->
product.detail_image_url - gallery strip ->
product.images
cdn_image_url, you should switch that hero to detail_image_url. Otherwise the page will keep using the smaller listing image.
Resolve Shop By Domain (Custom Domains)
If your theme is running on a custom domain, you can resolve the shop first:Source
Reference implementation:themes/default/src/main.tsxthemes/default/src/hooks/useStore.ts
getStore() vs getStorefront()
| Method | Returns | Use When |
|---|---|---|
getStore() | SDKResponse<Shop> | You only need store metadata (name, logo, settings) |
getStorefront() | SDKResponse<StorefrontData> | You need store + products + groups in one call, including mixed items order for storefront rendering |
getStorefront() is the recommended method for initial page load β it fetches everything in a single API call.
Next Steps
Cart & Checkout
Add to cart, coupons, and checkout flow.
SDK Reference
Complete API reference for all SDK methods.
Theme Settings
Load published settings and apply them (typically via CSS variables).
Troubleshooting
If data does not load, start here.