Hosted Shoppex storefronts use ThemeDocuments, not this SDK. Start at Themes for hosted theme work.
Package names
Use@shoppexio/storefront in browser and headless storefront code. Use @shoppexio/sdk only on trusted servers that call the Developer API.
Simple example:
- Browser product grid:
@shoppexio/storefront - Backend order automation:
@shoppexio/sdk - Hosted Shoppex theme: ThemeDocument plus the platform commerce runtime
What the SDK does
Public catalog reads
Fetch store metadata, products, groups, reviews, and listing data from public storefront endpoints.
Browser cart state
Add, update, and remove cart items. Cart data stays saved locally in the browser.
Hosted checkout handoff
Create a checkout handoff and redirect customers to Shoppex hosted checkout.
Framework neutral
Works with React, Vue, Svelte, Astro, plain HTML, or any browser runtime.
Install the SDK
Use the CDN build for the fastest start, with one script tag and no build step. Use npm instead if you have a bundler and want TypeScript types.Initialize and run your first request
After you load the SDK, initialize it with your store slug.string
required
Your store’s unique identifier. Find this in your Shoppex dashboard under Settings.
string
default:"en"
Default language for the SDK. Affects price formatting and checkout language.
string
Buyer currency for every priced read (
getStorefront, getStore, getProducts, getProduct) and for cart quotes and checkout. ISO 4217 code, and it must be one of the currencies enabled in the shop’s settings. Omit it to let the shop default and its country auto-detection decide. A ?currency= parameter on the page URL takes precedence over this option, for catalog reads and checkout alike.The currency is enforced, not a hint. A currency the shop has not enabled makes every priced read fail with the code
errors.storefront.currency_unavailable, and errorParams.available lists the enabled currencies. The SDK never silently falls back to the shop default. Enable the currency under Settings → Currencies in the dashboard, or drop the option.TypeScript and browser support
The SDK includes TypeScript definitions. Import types directly.Internet Explorer is not supported. The SDK uses modern JavaScript features such as Promises, async/await, and ES6+ syntax.
Use the Developer API for server work
The Storefront SDK is browser-safe and public. It does not replace the Developer API. Use the Developer API from your server when you need to:- create catalog-backed orders
- manage customers
- validate licenses
- fulfill orders
- manage webhooks
- read private operational data