optionsSubstore
Manages lazy-fetched option resources. Each key in the registry corresponds to a distinct SDK option (e.g., "priceForm") fetched from the API on first access and cached for subsequent reads.
Table of contents
getOption
getOption: <T extends keyof typeof optionsRegistry>( optionKey: T,) => ApiResource<z.infer<(typeof optionsRegistry)[T]["schema"]>>Retrieves an option resource by key, lazily fetching from the API on first access.
On the first call for a given key the SDK fires a background request. Subsequent calls return the cached ApiResource immediately. The returned object always reflects the current loading/error state so it is safe to read during render.
Parameters
| Name | Type | Description |
|---|---|---|
optionKey | keyof typeof optionsRegistry | The registry key identifying which option to fetch (e.g., "priceForm") |
Returns ApiResource<T> — data is undefined while loading, then holds the typed option payload once resolved.
Related
addonsSubstore.getAddons— same lazy-fetch pattern for addonsappearanceSubstore.getAppearance— same lazy-fetch pattern for appearance configlocalizationSubstore.selectedLanguage— language slug used when building the API requestformCategoriesSubstore.strategies—priceFormoption is read internally to configure category strategy behaviour