Loading...
Loading...
Commerce Engine product catalog - products, variants, SKUs, categories, faceted search, reviews, and recommendations.
npx skill4agent add commercengine/skills ce-catalogLLM Docs Header: All requests tomust include thehttps://llm-docs.commercengine.ioheader (or appendAccept: text/markdownto the URL path). Without it, responses return HTML instead of parseable markdown..md
Prerequisite: SDK initialized and anonymous auth completed. See.setup/
| Task | SDK Method |
|---|---|
| List products | |
| Get product detail | |
| List variants | |
| Get variant detail | |
| List SKUs (flat) | |
| List categories | |
| Search products | |
| Get reviews | |
| Submit review | |
| Similar products | |
| Upsell products | |
| Cross-sell products | |
Product (has_variant: false)
└─ A simple product with one SKU, one price
Product (has_variant: true)
├─ Variant A (Color: Red, Size: M) → SKU: "RED-M-001"
├─ Variant B (Color: Red, Size: L) → SKU: "RED-L-001"
└─ Variant C (Color: Blue, Size: M) → SKU: "BLU-M-001"| Concept | Return Type | Description | When to Use |
|---|---|---|---|
| Product | | Base item with nested | PLP where one card per product is desired (e.g., "T-Shirt" card showing color/size selectors) |
| Variant | — | A specific option combo (Color + Size) | PDPs, cart items — accessed via |
| SKU / Item | | Flat sellable unit — each variant is its own record | PLP where a flat grid is desired (each color/size combo = separate card), or any page with filters/sorting/search |
User Request
│
├─ "Show products" / "Product list"
│ ├─ With filters/sorting/search? → sdk.catalog.searchProducts({ query, filter, sort, facets })
│ │ → Returns Item[] (flat SKUs) + facet_distribution + facet_stats
│ ├─ Flat grid (no filters)? → sdk.catalog.listSkus()
│ │ → Returns Item[] (flat SKUs)
│ └─ One card per product (group variants)? → sdk.catalog.listProducts()
│ → Returns Product[] (with nested variants)
│
├─ "Product detail page"
│ ├─ sdk.catalog.getProductDetail({ product_id_or_slug })
│ └─ If has_variant → sdk.catalog.listProductVariants({ product_id })
│
├─ "Search" / "Filter" / "Sort"
│ └─ sdk.catalog.searchProducts({ query, filter, sort, facets })
│ → Returns Item[] + facet_distribution + facet_stats
│
├─ "Categories" / "Navigation"
│ └─ sdk.catalog.listCategories()
│
├─ "Reviews"
│ ├─ Read → sdk.catalog.listProductReviews({ product_id })
│ └─ Write → sdk.catalog.createProductReview({ product_id }, body)
│
└─ "Recommendations"
├─ Similar → sdk.catalog.listSimilarProducts()
├─ Upsell → sdk.catalog.listUpSellProducts()
└─ Cross-sell → sdk.catalog.listCrossSellProducts()searchProductsItem[]facet_distributionfacet_statsconst { data, error } = await sdk.catalog.searchProducts({
query: "running shoes",
filter: "pricing.selling_price 50 TO 200 AND categories.name = footwear",
sort: ["pricing.selling_price:asc"],
facets: ["categories.name", "product_type", "tags"],
page: 1,
limit: 20,
});
// data.skus → Item[] (flat list — each variant is its own record)
// data.facet_distribution → { [attribute]: { [value]: count } }
// data.facet_stats → { [attribute]: { min, max } } (e.g. price range)
// data.pagination → { page, limit, total, total_pages }
// filter also accepts arrays — conditions are AND'd:
// filter: ["product_type = physical", "rating >= 4"]
//
// Nested arrays express OR within AND:
// filter: ["pricing.selling_price 50 TO 200", ["categories.name = footwear", "categories.name = apparel"]]const { data, error } = await sdk.catalog.listProducts({
page: 1,
limit: 20,
category_id: ["cat_123"], // Optional: filter by category
});
// data.products → Product[] (each product may contain a variants array)
// Check product.has_variant to know if options existconst { data, error } = await sdk.catalog.listSkus();
// Returns Item[] — same flat type as searchProductsconst { data, error } = await sdk.catalog.getProductDetail({
product_id_or_slug: "blue-running-shoes",
});
const product = data?.product;
// If product has variants, fetch them
if (product?.has_variant) {
const { data: variantData } = await sdk.catalog.listProductVariants({
product_id: product.id,
});
// variantData.variants contains all options with pricing and stock
}| Type | Description | Key Fields |
|---|---|---|
| Tangible goods requiring shipping | |
| Downloadable or virtual products | No shipping required |
| Group of products sold together | Contains sub-items |
stock_availablefalsebackordertruestock_availablefalsebackordertruelistProductslistSkuscustomer_group_iddefaultHeaderssetup/| Level | Issue | Solution |
|---|---|---|
| CRITICAL | Building PLP with filters using | Use |
| CRITICAL | Confusing | |
| HIGH | Ignoring | Always check |
| HIGH | Adding product to cart instead of variant | When |
| MEDIUM | Not using | Use |
| MEDIUM | Missing pagination | All list endpoints return |
| LOW | Re-fetching categories | Categories rarely change — cache them client-side |
setup/cart-checkout/orders/nextjs-patterns/generateStaticParams()