@shoppexio/storefront, grouped by object: Store, Products, Cart, Checkout, Reviews and invoices, and Types.
All async SDK methods return
SDKResponse<T>, a wrapper containing data, error, and status fields. See Response types for the full definition.Store
The Store object gives access to your shop’s public information, including name, branding, and settings.getStore
Fetches the store’s public metadata.Shop
getStoreLogoUrl
Returns the store’s logo URL directly.string | null
Logo URL or
null if no logo is setgetStoreBannerUrl
Returns the store’s banner URL directly.string | null
Banner URL or
null if no banner is setStore error handling
Products
Fetch products from your store, including variants, addons, and custom fields.getProducts
Fetches all products from the store.Product[]
Array of products
Product prices are returned as
string types to preserve decimal precision. Always use shoppex.formatPrice() for display. Do not calculate directly with price strings.Use product images by surface:
cdn_image_urlfor product cards, category grids, cart rows, and search resultsdetail_image_urlfor product detail pages, image galleries, and zoomimages[]for the full gallery
cdn_image_url, switch that hero to detail_image_url to get the higher-resolution image.getProduct
Fetches a single product by ID or slug.string
required
Product unique ID or URL slug
getCategories
Fetches all unique product category IDs from your store.Product groups
Stores can organize products into groups (for example, “Server Boosts”, “Tokens”). Groups come fromgetStorefront().
string
Unique group identifier
string
Group name
string[]
References to the group’s products. Resolve them against the flat products list. The full product objects are not embedded in the group.
number
Number of products in the group
number
Display order of the group
Migrating from 0.3.x? Replace every
group.products_bound read with the lookup above. getProducts() now returns the complete flat catalog, group-bound products included, so you no longer need to merge group products into your listing yourself. If you call the REST API directly, /v1/storefront/products/public/:slug groups carry product_uniqids. The /v1/storefront/products/shop/:name endpoint no longer returns groups at all. Read groups from the public catalog or bootstrap payload instead.Working with variants
Products can have multiple variant types. Standard variants Variants such as size or color that do not change the price.Products error handling
Cart
The Cart object manages shopping cart state in the browser’s localStorage. Cart data stays saved across page refreshes and browser sessions.Cart data is stored in the browser’s
localStorage. If the user clears browser storage, the cart is lost.getCart
Returns all items currently in the cart.CartItem[]
getCartItemCount
Returns the total number of items in the cart.addToCart
Adds an item to the cart, or increments quantity if it already exists.string
required
Product unique identifier
string
required
Variant ID. Use empty string
'' for products without variants.number
default:"1"
Number of items to add
CartAddOptions
updateCartItem
Updates an existing cart item.string
required
Product unique identifier
string
required
Variant ID
object
required
removeFromCart
Removes an item from the cart.string
required
Product unique identifier
string
required
Variant ID
clearCart
Removes all items from the cart.Cart backup
The SDK can back up the cart before checkout, to restore it if checkout is cancelled. createCartBackupComplete cart UI example
Checkout
The Checkout object redirects customers to Shoppex hosted checkout. Checkout is fully hosted by Shoppex for PCI compliance.checkout
Redirects the customer to the checkout page with their cart contents.string
Pre-applied coupon code
CheckoutOptions
buildCheckoutUrl
Builds the checkout URL without redirecting. Use this to open checkout in a new tab or iframe.string
Coupon code to pre-apply
string
Checkout language (for example, ‘en’, ‘de’, ‘fr’)
buildCheckoutUrlSync (deprecated)
buildCheckoutUrlSync is deprecated and throws immediately. Use buildCheckoutUrl() instead. It handles both default and custom domains.Coupons
validateCoupon Validates a coupon code before checkout. Affiliate and referral codes are separate from coupons. UsevalidateAffiliateCode or applyAffiliateCode for those instead.
string
required
Coupon code to validate
string
Product ID to check product-specific coupons
string
Selected variant ID to check variant-specific coupons. Requires
options.productId.CouponValidation
Affiliate codes
validateAffiliateCode Validates an affiliate or referral code without storing it.checkout() sends the stored code as affiliate_code.
Checkout flow
After checkout
After successful checkout, the cart is automatically cleared. If you need to handle the return, read the order ID from the URL.Reviews and invoices
This section documents two separate objects: shop reviews and invoice status.getShopReviews
Fetches all public reviews for the store.Feedback[]
getInvoice
Fetches full invoice details.Invoice
getInvoiceStatus
Lightweight endpoint for status polling. Use this instead ofgetInvoice for real-time updates.
Formatting utilities
formatPrice Formats a price with a currency symbol.number
required
Price amount
string
default:"Store currency"
ISO 4217 currency code
string
default:"en"
Locale for formatting
Intl.NumberFormat instance.
Types
The SDK is written in TypeScript and exports all type definitions. Install with npm to get full IntelliSense support.Configuration types
Response types
Store types
Product types
Image fields have different jobs:
cdn_image_urlis the optimized storefront cover for cards and listsdetail_image_urlis the higher-resolution primary image for product detail pagesimages[]contains the gallery
cdn_image_url and switch your PDP hero and gallery to detail_image_url.