Search Documentation

Search for a documentation page...

Collections

Create and manage product collections with the Commerce SDK.

Browse Collections

Fetch all collections:

const collections = await commerce.collectionBrowse();

Get a Collection

Fetch a single collection by ID or slug:

const collection = await commerce.collectionGet({
idOrSlug: "summer-sale",
});

Response

{
id: "col_abc123",
name: "Summer Sale",
slug: "summer-sale",
description: "Hot deals for the summer season",
products: [...],
}

Create a Collection

const collection = await commerce.collectionCreate({
name: "New Arrivals",
slug: "new-arrivals",
description: "Fresh products just added to the store",
});

Products in Collections

Use the collectionSlug parameter when browsing products to filter by collection:

const products = await commerce.productBrowse({
collectionSlug: "summer-sale",
limit: 20,
});

Collections vs Categories

CollectionsCategories
PurposeCurated product groupsHierarchical taxonomy
StructureFlat listCan be nested
Use case"Staff Picks", "Sale""Clothing > T-Shirts"
ManagementManual product assignmentProduct categorization

Both can be used together — a product can belong to multiple collections and one or more categories.

Import Memberships

Bulk-import collection-product memberships from a CSV file (e.g. WooCommerce/Shopify migration data). Idempotent across re-runs.

const result = await commerce.collectionImportMemberships({
file: csvFile, // File or Blob
});

Response

{
ok: true,
processed: 1000,
inserted: 950,
skipped_existing: 40,
errors: [],
}