These hooks give your components access to live checkout data and the ability to modify the checkout experience. All hooks are TypeScript-ready with full type definitions, and are imported from
@ollie-shop/sdk.Quick Reference
useCheckoutSession
Read the parsed checkout session (cart items, customer, totals, locale) and validate it
useCheckoutAction
Mutate the checkout: add/remove items, update quantities, coupons, addresses, payments
useStoreInfo
Store metadata, theme tokens, props/settings, and injected components
useMessages
Add, remove, and clear notification messages
usePendingActions
Track in-flight checkout actions to drive loading states
useCheckoutOrder
Access the finalized order after checkout completes
useLogin
Open and close the native login modal
useNavigation
Block or allow leaving the current checkout step
useCheckoutSession
The primary hook for reading checkout data. To change the cart, useuseCheckoutAction: the session hook never calls the platform. updateSession only replaces the context with a session you already have, and revalidate re-fetches the current one.
It returns { session, rawSession, updateSession, sessionValidity, sessionValidate, revalidate, revalidateAsync, isFallback, fallbackError, clearFallback }. The parsed, platform-agnostic data lives on session. See useCheckoutSession for every return value.
- 📊 Cart Data
- 👤 Customer Data
- 🛠️ Modifying the Cart
Access cart contents and totals
session.totals (all amounts in minor units / cents):session.cartItems[]:useStoreInfo
Access store metadata, theme tokens, and configuration.Omit<StoreInfo, "messages">):
Combining Hooks
Use
usePendingActions to disable buttons or
show skeletons while a useCheckoutAction call
is in flight. The pending list is updated automatically by the action hook.