NPM Package
@commercengine/checkout
SolidJS integration for Commerce Engine Checkout.
Installation
Setup
CallinitCheckout once at your app’s entry point. The SDK resolves the hosted URL from storeId + environment using store-specific subdomains:
index.tsx
Use the primitive
useCheckout() returns an object with reactive getters (powered by Solid signals) and action methods:
CartButton.tsx
Each property on the returned object is a getter backed by a Solid signal. Components only re-render when the specific values they access change.
Feature flags, login methods, drawer direction, and payment provider are managed in Checkout Studio (Config API), not as SDK init options. Use
theme only for per-session overrides.Fine-grained signals
For minimal subscriptions, use the individual signal creators:CartBadge.tsx
createCartCountSignal, createIsReadySignal.
Full example
App.tsx
SolidStart
For SolidStart, initialize in the root layout. The SDK no-ops during SSR.root.tsx
Primitive API reference
useCheckout() returns:
| Property | Type | Description |
|---|---|---|
isReady | boolean (reactive getter) | true when the checkout iframe is loaded |
isOpen | boolean (reactive getter) | true when the overlay is visible |
cartCount | number (reactive getter) | Number of items in the cart |
cartTotal | number (reactive getter) | Cart subtotal |
cartCurrency | string (reactive getter) | Currency code |
isLoggedIn | boolean (reactive getter) | Whether a user is logged in |
user | UserInfo | null (reactive getter) | Current user info |
openCart() | function | Open the cart drawer |
openCheckout() | function | Open checkout directly |
close() | function | Close the overlay |
addToCart(productId, variantId, quantity?) | function | Add an item to the cart |
updateTokens(accessToken, refreshToken?) | function | Sync auth tokens |