NPM Package
@commercengine/checkout
Svelte integration for Commerce Engine Checkout.
Installation
Setup
CallinitCheckout once in your root layout or entry file. The SDK resolves the hosted URL from storeId + environment using store-specific subdomains:
+layout.svelte
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.Use the store
Import thecheckout readable store and access it with $checkout:
CartButton.svelte
Fine-grained stores
For components that only need a single value, use the individual stores to minimize re-renders:CartBadge.svelte
cartCount, cartTotal, isReady, isOpen.
Full example
App.svelte
SvelteKit
For SvelteKit, initialize in the root layout. The SDK is client-only and safely no-ops during SSR.src/routes/+layout.svelte
Store API reference
Thecheckout store value contains: