ce-catalog
Original:🇺🇸 English
Translated
Commerce Engine product catalog - products, variants, SKUs, categories, faceted search, reviews, and recommendations.
2installs
Sourcecommercengine/skills
Added on
NPX Install
npx skill4agent add commercengine/skills ce-catalogTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →LLM 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
Products & Catalog
Prerequisite: SDK initialized and anonymous auth completed. See.setup/
Quick Reference
| 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 Hierarchy
Understanding the Product → Variant → SKU relationship is critical:
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 |
Decision Tree
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()Key Patterns
Product Listing Page (PLP)
For PLPs with filters, sorting, or search — use (recommended). It returns (flat SKUs) plus and for building filter UI:
searchProductsItem[]facet_distributionfacet_statstypescript
const { 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"]]For PLPs without filters where one card per product is desired (variants grouped under a single card):
typescript
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 existFor a flat grid without filters (each variant = separate card):
typescript
const { data, error } = await sdk.catalog.listSkus();
// Returns Item[] — same flat type as searchProductsProduct Detail Page (PDP)
typescript
const { 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
}Product Types
| Type | Description | Key Fields |
|---|---|---|
| Tangible goods requiring shipping | |
| Downloadable or virtual products | No shipping required |
| Group of products sold together | Contains sub-items |
Inventory & Availability
- — Boolean, always present on Product, Variant, and SKU schemas. Use it to disable "Add to Cart" or show "Out of Stock" when
stock_available.false - — Boolean, set per product in Admin. When
backorder, the product accepts orders even when out of stock. If your business allows backorders, keep the button enabled whentrueisstock_availablebutfalseisbackorder.true - Inventory count — Catalog APIs (,
listProducts, etc.) support including inventory data in the response. Use this to display numeric stock levels in the UI.listSkus
Customer Groups & Pricing
An advanced feature for B2B storefronts where the admin has configured customer groups (e.g., retailers, stockists, distributors). When is sent in API requests, product listings, pricing, and promotions are returned for that specific group.
customer_group_idDo not pass the header per-call. Set it once via in SDK config (see § "Default Headers"). After the user logs in, update the SDK instance with their group ID — all subsequent SDK calls automatically include it.
defaultHeaderssetup/Wishlists
Commerce Engine supports wishlists (add, remove, fetch) via SDK methods. These skills cover the main storefront flows — for wishlists and other secondary features, refer to the LLM API reference or CE docs.
Common Pitfalls
| 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 |
See Also
- - SDK initialization required first
setup/ - - Adding products to cart
cart-checkout/ - - Products in order context
orders/ - - SSG for product pages with
nextjs-patterns/generateStaticParams()
Documentation
- Catalog Guide: https://www.commercengine.io/docs/storefront/catalog
- API Reference: https://www.commercengine.io/docs/api-reference/catalog
- LLM Reference: https://llm-docs.commercengine.io/storefront/operations/list-products