checkout store and fine-grained stores for common state.
Installation
Checkout-only Svelte app
Initialize and destroy checkout from the root lifecycle:src/App.svelte
Svelte app with Storefront SDK
For a browser Svelte application using the Storefront SDK, configure SDK-to-checkout token updates insidesession, then initialize checkout in provided mode.
src/lib/storefront.ts
src/App.svelte
SvelteKit
Use the first-party@commercengine/storefront/sveltekit wrapper when the SvelteKit application uses the Storefront SDK. It aligns browser and request-cookie sessions.
Follow SvelteKit SDK integration for the complete provided-mode pattern.
For a checkout-only SvelteKit site, initialize managed mode inside onMount and destroy it in onDestroy:
src/routes/+layout.svelte
Use the store
src/lib/CartButton.svelte
src/lib/AddToCartButton.svelte
null for simple products; resolve a valid variant ID before enabling the button for variant products.
Fine-grained stores
Use the individual stores when a component only needs one value:cartCount, cartTotal, isReady, and isOpen.
Store API
Production checklist
SvelteKit production starters
Review native SvelteKit storefront implementations for load boundaries, prerendering, session bootstrap, search races, SEO, and deployment patterns.