Developers
Start building
Themes/Theme SDK/Modules/data

data

Store reads: products, categories, collections, attributes, product types and the content pages and posts a setting points to, each one named hook with one result shape.

On this page
import { … } from '@poltura/theme-sdk/data';

Hooks

NameWhat it is
useProductsOne page of product cards matching a query, priced for the visitor.
useInfiniteProductsProduct cards matching a query, a page at a time, for "load more" and endless lists.
useProductOne product with every variant, option and specification, priced for the visitor.
useCategoriesThe store's categories, in the merchant's order.
useCategoryOne category with its path, description, image and subcategories.
useCollectionsThe store's collections.
useCollectionOne collection with its description and image.
useProductAttributesProduct attributes with their values, by key or as a category offers them for filtering.
useProductTypesThe store's product types, such as "T-shirt" or "Gift card".
useCollectionListEntryOne pick of a collectionList setting, read as a card: its title, page and image.
usePageThe site page a page setting points to.
usePostThe blog post or guide a post setting points to.

Constants

NameWhat it is
StoreReadErrorA failed store read; instanceof StoreReadError holds for it wherever the theme renders.

Types

NameWhat it is
CategoryA product category with its place in the category tree.
CategoryQueryWhich categories useCategories lists.
CategoryRefA category as other view models link to it.
CollectionA hand-picked group of products with its own page.
CollectionQueryWhich collections useCollections lists.
CollectionRefA collection as other view models link to it.
InfiniteQueryResultWhat useInfiniteProducts answers: every page loaded so far and a way to load the next.
PageRequestWhich page of a list to read.
ProductAttributeA merchant-defined product attribute a list can be filtered by, such as material or colour.
ProductAttributeValueOne value of a product attribute, such as "Cotton" or "Red".
ProductPageOne page of a product list.
ProductQueryWhich products useProducts lists; every given narrowing applies at once.
ProductSortThe orders a product list can be sorted in.
ProductTypeRefA product type, such as "T-shirt" or "Gift card".
QueryOptionsOptions every data hook takes.
QueryResultWhat a data hook answers: the data once it arrived, the read's status and a way to read again.
QueryStatusWhere a read is: still loading its first answer, failed, or answered.
StoreReadErrorCodeWhy a store read failed.
SuspenseQueryOptionsQueryOptions that suspend: the hook answers a SuspenseQueryResult.
SuspenseQueryResultWhat a data hook answers with { suspense: true }: the component renders only once the data is there.
ProductLookupNames one product, by its URL segment or by its id.
CategoryLookupNames one category, by its URL path from the root or by its id.
CollectionLookupNames one collection, by its URL segment or by its id.
ProductAttributeLookupSelects what useProductAttributes reads: by key, or every attribute a category offers.
CollectionListPickOne pick of a collectionList setting: a collection or a category by its URL segment.
CollectionListEntryA collection or category in a collection list.
ContentEntryA content page, blog post or guide as a setting points to it.
PostLookupThe value of a post setting: a blog post or a guide by its URL segment.
Last updated