useCheckout(). No plugin injection or provider component is required.
Installation
Checkout-only Vue app
When the app does not use the Storefront SDK, initialize checkout before mounting the application. Checkout owns authentication and session refresh.src/main.ts
Vue app with Storefront SDK
When@commercengine/storefront is present, use provided mode. First send SDK token changes to checkout:
src/lib/storefront.ts
src/main.ts
Use the composable
src/components/CartButton.vue
src/components/AddToCartButton.vue
null for a product without variants. For variant products, wait until the selection resolves to a purchasable variant ID.
Nuxt 3
Initialize Hosted Checkout in a client-only plugin. If Nuxt also uses Commerce Engine session APIs, use@commercengine/ssr-utils for request-bound server storage and provided mode for checkout.
plugins/checkout.client.ts
.client.ts suffix prevents browser-only checkout code from entering the server bundle.
Composable API
Production checklist
Vue and framework starters
Use the production starters to compare SPA behaviour with SSR framework boundaries and deployment configuration.