Collections
Collections group products for navigation and merchandising. Products are derived dynamically from filter rules.
Creating Collections
const collection = await collectionService.create({
name: "Summer Sale",
slug: "summer-sale",
description: "Best deals for summer"
});Filter Rules
Collections use filter rules stored as rows in collection_filters. Products matching the filters are included automatically.
// Add a facet filter — include products with specific facet values
await collectionService.addFilter(collectionId, {
field: "facet",
operator: "in",
value: { facetId: 5, valueIds: [12, 13] }
});
// Add a price filter — products under 50€
await collectionService.addFilter(collectionId, {
field: "price",
operator: "lte",
value: 5000
});
// Remove a filter
await collectionService.removeFilter(filterId);Filter Fields
| Field | Description |
|---|---|
facet | Products with specific facet values |
price | Price range |
stock | Stock level |
visibility | Product visibility |
product | Specific products (manual) |
variant | Specific variants |
Filter Operators
eq, in, gte, lte, gt, contains
Querying Collections
// Get collection by slug
const collection = await collectionService.getBySlug("summer-sale");
// Get products for a collection with pagination
const { items, pagination } = await collectionService.getProductsForCollection(
collection.id,
{ limit: 20, offset: 0 }
);Last updated on