Catalogue
Products, categories, collections, bundles, composites, and price quotes.
TS
// Fetch products by category, get details, then quote a variant with add-ons
const products = await client.catalogue.getProducts({ category: 'cat_beverages', limit: 10 })
if (!products.ok) throw products.error
const detail = await client.catalogue.getProduct(products.value.items[0].id)
if (!detail.ok) throw detail.error
const quote = await client.catalogue.fetchQuote({
product_id: detail.value.id,
variant_id: 'var_large',
quantity: 2,
add_on_option_ids: ['addon_oat_milk', 'addon_extra_shot'],
location_id: 'loc_main',
})
if (!quote.ok) throw quote.error
console.log(quote.value.quote_id, quote.value.expires_at)getProducts
Returns a paginated list of products with optional filtering.
TS
const result = await client.catalogue.getProducts({
category: 'cat_beverages',
collection: 'col_summer',
search: 'latte',
featured: true,
limit: 20,
})
if (result.ok) {
console.log(result.value.items) // Product[]
console.log(result.value.is_complete) // boolean
console.log(result.value.pagination) // pagination metadata
}| Option | Type | Description |
|---|---|---|
category | string | Filter by category ID |
collection | string | Filter by collection ID |
search | string | Full-text search query |
featured | boolean | Featured products only |
limit | number | Max items to return |
getProduct / getProductBySlug
TS
const byId = await client.catalogue.getProduct('prod_xxxxx')
const bySlug = await client.catalogue.getProductBySlug('iced-latte')
// Both return Result<ProductWithDetails> — includes variants, add-ons, imagesCategories and Collections
TS
const categories = await client.catalogue.getCategories() // Result<Category[]>
const collections = await client.catalogue.getCollections() // Result<Collection[]>
const collection = await client.catalogue.getCollection('col_xxxxx') // Result<Collection>Bundles and Composites
Bundles are fixed product groupings. Composites let customers pick components (build-your-own).
TS
const bundle = await client.catalogue.getBundle('bun_xxxxx')
// Result<BundleDetails> — includes components and pricing
const composite = await client.catalogue.getComposite('comp_xxxxx')
// Result<CompositeDetails> — includes component options and constraintsSearch
TS
const results = await client.catalogue.search('espresso')
// Result<Product[]> — convenience wrapper over getProducts({ search })Price Quotes
Use quotes when variants, add-ons, bundles, or composites affect the final price. Quotes have an expires_at timestamp and must be refreshed if expired.
TS
// Fetch a new quote
const quote = await client.catalogue.fetchQuote({
product_id: 'prod_xxxxx',
variant_id: 'var_large',
quantity: 2,
add_on_option_ids: ['addon_oat_milk'],
location_id: 'loc_main',
})
if (!quote.ok) throw quote.error
// Pass quote_id when adding to cart
await client.cart.addItem({
item_id: 'prod_xxxxx',
quantity: 2,
variant_id: 'var_large',
quote_id: quote.value.quote_id,
add_on_options: ['addon_oat_milk'],
})
// Refresh an expired or changed quote
const refreshed = await client.catalogue.refreshQuote({
quote_id: quote.value.quote_id,
quantity: 3,
})
if (refreshed.ok) {
console.log(refreshed.value.quote.quote_id)
}| fetchQuote Input | Type | Required |
|---|---|---|
product_id | string | Yes |
quantity | number | No |
variant_id | string | No |
location_id | string | No |
add_on_option_ids | string[] | No |
bundle_selections | BundleSelection[] | No |
composite_selections | CompositeSelection[] | No |
All Methods
| Method | Returns |
|---|---|
getProducts(opts?) | Result<CatalogueResult<Product>> |
getProduct(id) | Result<ProductWithDetails> |
getProductBySlug(slug) | Result<ProductWithDetails> |
getCategories() | Result<Category[]> |
getCollections() | Result<Collection[]> |
getCollection(id) | Result<Collection> |
getBundle(id) | Result<BundleDetails> |
getComposite(id) | Result<CompositeDetails> |
search(query) | Result<Product[]> |
fetchQuote(input) | Result<PriceQuote> |
refreshQuote(input) | Result<{ quote: PriceQuote }> |