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
useCheckoutSession
The primary hook for reading checkout data. To change the cart, useuseCheckoutAction — the session hook is read-only and does not expose mutation functions.
It returns { session, rawSession, updateSession, sessionValidity, ... }. The parsed, platform-agnostic data lives on session.
- 📊 Cart Data
- 👤 Customer Data
- 🛠️ Modifying the Cart
Access cart contents and totals
session.totals (all amounts in minor units / cents):| Property | Type | Description |
|---|---|---|
items | number | Total cost of items in the cart |
shipping? | number | Total shipping cost |
tax? | number | Total tax amount |
discounts? | number | Total discount amount |
giftCard? | number | Total gift card amount |
interest? | number | Total interest (e.g. from installments) |
total | number | Grand total for the checkout |
session.cartItems[]:| Property | Type | Description |
|---|---|---|
id | string | Item identifier (e.g. SKU code) |
sellerId? | string | Marketplace seller/vendor identifier |
name | string | Display name |
variant? | string | Variant name (e.g. “Size Large”) |
brand? | string | Brand name |
category? | string | Primary product category |
price | number | Current (sale) price in cents |
originalPrice | number | Original (non-sale) price in cents |
quantity | number | Quantity of this item |
available | boolean | Whether the item is in stock |
index | number | Position index in the cart |
image | string | Image URL |
uniqueId | string | Unique id of the cart line |
url? | string | URL to the product details |
variantDetails? | Record<string, string> | Variant info (color, size…) |
useStoreInfo
Access store metadata, theme tokens, and configuration.Omit<StoreInfo, "messages">):
| Property | Type | Description |
|---|---|---|
platform | string | E-commerce platform (e.g. “vtex”) |
platformStoreId | string | Store id on the platform |
storeId? | string | Ollie store id |
logo? | string | Store logo URL |
versionId? | string | Active store version id |
correlationId? | string | Request correlation id |
template? | TemplateType | Active template |
theme? | Record<string, string> | Flat design tokens |
props? | object | Version props and feature flags |
settings? | Record<string, unknown> | Store settings |
components? | CustomComponent[] | Custom components injected into this store |
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.