Sell your Sokko catalogue on a site you already run
@sokkoke/storefront-react is a headless React package. It gives you catalogue fetching, variant selection, a local basket and the handoff to checkout, with no styling layer. You write every element and class name.
- You need
- A duka on Sokko, and its storefront id.
- You do not need
- An API key, a secret, or a server route of your own.
- Sokko keeps
- Checkout, payment, installments and delivery.
Install
React 18 or 19 is the only peer. The package is ESM only.
npm install @sokkoke/storefront-react
Create the client
Once, at module scope. That one id is the whole setup.
src/lib/store.jsimport { createStorefront, createCartStore } from '@sokkoke/storefront-react'; export const storefront = createStorefront({ storefrontId: 'your-storefront-id' }); export const cart = createCartStore({ namespace: 'your-site' });
No API key and no server step. The package speaks only to Sokko public storefront endpoints.
Your own id, with this snippet already filled in, is in your Sokko dashboard under Settings, Developers.
Show your products
Each hook is the headless version of one storefront component. You write the markup.
src/StoreListing.jsximport { useCatalogue } from '@sokkoke/storefront-react'; import { storefront } from './lib/store'; export function StoreListing() { const { status, products } = useCatalogue(storefront); if (status !== 'ready') return <YourSkeleton />; return ( <ul> {products.map((product) => ( <ProductTile key={product.id} product={product} /> ))} </ul> ); }
Hand off to checkout
Buyers finish on Sokko, so payment, installments and delivery stay with us.
src/BuyButton.jsximport { useProductPurchase, checkoutNoticeFor, formatPrice } from '@sokkoke/storefront-react'; import { storefront, cart } from './lib/store'; export function BuyButton({ product }) { const { selectedVariant, buyNow, checkoutStatus } = useProductPurchase(storefront, cart, product); const busy = checkoutStatus === 'working'; return ( <> <button disabled={!selectedVariant || busy} onClick={() => buyNow()} > {selectedVariant ? `Buy ${formatPrice(selectedVariant.priceAmount)}` : 'Select an option'} </button> <p>{checkoutNoticeFor(product)}</p> </> ); }
Checkout is a full navigation to a Sokko address. Tell buyers where they are going: an unannounced change of site reads as a broken link. checkoutNoticeFor(product) is written copy for exactly that, with the installment line added for items that qualify.
Each hook is the headless version of one storefront component. Compose them under your own markup.
- Store listinguseCatalogue
- Fetch state (loading, ready, error) and your products.
- Product tileuseProductTile
- Primary image, srcSet, the "from" price, and whether the product has options.
- Product pageuseProduct, useProductPurchase, useGallery, useRelatedProducts
- Load and missing states, variant selection, clamped quantity, add to basket, buy now, gallery, and a related strip drawn from your own catalogue.
- Cart dockuseCartDock
- Drawer open and close, totals, checkout, and the modal contract: Escape closes, Tab cycles, focus returns, scroll locks.
Charisma runs the package on their own site, in their own type and colour. The cards, the prices under them and the basket count in their header all come from the hooks.

Every hook, the API facts worth knowing, and a product page in about twenty lines are in the package readme.
@sokkoke/storefront-react on npm
