Skip to main content
This page is the curated reference. The complete, generated type reference lives at /kit/api/core and is regenerated from the published typings.
Everything on this page is exported from the root entry, @quickbutik/kit, and runs on a server and in a browser alike. The React hooks and the web components are thin bindings over these same functions.

Variant matrix

Pure functions over a Product and a VariantSelection (Record<optionId, valueId>). A server can resolve the initial variant and price before anything hydrates.
object
object
available means “this combination exists and is not hidden”, not “in stock”. stock.stock is null for shops that do not track inventory, and null means purchasable. Keep unavailable values clickable; selectOptionValue repairs the selection.

ProductController

The same logic as a stateful, subscribable object. <ProductProvider> and <qb-product> are both bindings over it.
number
boolean
default:"false"

Images

Never render image.path: it is a bare storage filename, not a URL. These helpers build CDN URLs from image.url. See Images.
object
imgix-compatible parameters.
ProductImageUrlOptions adds baseUrl (a fallback base for a bare path) and cacheBust (default true, appends contentHash as ?v=).

Money

All amounts are minor units. Decimals follow the currency (JPY and ISK have none). Format with the currency the response states (product.currency, cart.currency), never a constant.

Currencies

See Currencies.
CurrencyInfo is on Types.

SEO

See SEO for how to use them.

Storage, cookies and runtime

See Storage & SSR. A StorageAdapter is any { kind, get(key), set(key, value, { ttlSeconds }), remove(key) }; each method may return a promise. createRequestCookieStorage reads cookies from a Request, a Headers or a raw Cookie header string, and pushes every write as a Set-Cookie string into collect:

Async state

AsyncResource<T> is the framework-free state behind the React catalog hooks: run(operation) aborts the previous run and discards a superseded result, abort(), hydrate(data), subscribe, getSnapshot() returning { data, status, loading, error }.

Campaign storefronts

storefrontRefusal(error) narrows any thrown value to a typed refusal, or null. The shapes are on Errors & scopes. isStorefrontId, isStorefrontSurface, STOREFRONT_ID_PATTERN, STOREFRONT_SURFACES and DEFAULT_STOREFRONT_SURFACE are exported alongside it. The framework-free layer under <ShopkitProvider> and the elements, for a page that composes it itself. The provider and the elements set all of this up by default; see Consent and analytics.

ConsentStore

number
default:"1"
Bump it to ask every shopper again: a decision stored under an older revision reads as undecided.
number
default:"180"
string
Host-only by default. .myshop.com shares it across subdomains.
'lax' | 'strict' | 'none'
default:"lax"
boolean
On https by default.
boolean
default:"true"
false when a third-party consent platform owns the cookie; call save() from its callback.
ConsentState | null
The server’s read. Without it the store reads the cookie; null starts undecided without reading.
Every decision is also dispatched on document as qb:consent (CONSENT_EVENT) with the state as detail.

Analytics

Analytics is the hub: it fans GA4-shaped events out to destinations gated on consent, remembers events a destination cannot take yet (consent pending, ids still loading) and drops them on denial.

Destinations

Your own destination is one object implementing AnalyticsDestination:
string
required
Unique per hub.
string
Which vendor account it reports to. Lets an inline destinations array keep the destination across renders without replaying events into it.
'necessary' | 'analytics' | 'marketing' | null
required
The category it needs before it receives anything, load() included. null: always, and it gates itself.
void
Put the vendor’s script on the page. Called once, the first time it is allowed. Must be idempotent.
The decision changed.
void
required
void
The purchase, with the id Meta and the platform dedupe it by. Without it, the purchase arrives through track().

Event builders

Pure mappers to GA4’s vocabulary: money in major units, item_id the bare numeric product id, the variant as item_variant.

Checkout handoff