ce
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLLM 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
LLM 文档头部要求:所有发送至的请求必须携带https://llm-docs.commercengine.io请求头(或者在 URL 路径后追加Accept: text/markdown)。缺少该配置的话,响应会返回 HTML 而非可解析的 markdown 内容。.md
Commerce Engine Skills Router
Commerce Engine 技能路由器
These skills cover B2C storefronts. B2B storefronts share ~95% of the same patterns — the main difference is customer group pricing (see § "Customer Groups & Pricing" and § "Default Headers").
ce-catalogce-setupBased on what you're trying to do, here's the right skill to use:
这些技能适用于B2C 店面。B2B 店面与 B2C 有~95%的模式是共通的,核心差异在于客户群体定价规则(参考 § "客户群体与定价" 以及 § "默认请求头" 部分)。
ce-catalogce-setup根据你要完成的任务,可选择对应的技能模块:
By Task
按任务分类
Setting up the SDK → Use
ce-setup- Framework detection and SDK install
- Token storage selection
- Environment variables (,
CE_STORE_ID)CE_API_KEY
Authentication & login → Use
ce-auth- Anonymous auth (always required)
- OTP login (email/phone/WhatsApp), password auth, token refresh
- Note: If using Hosted Checkout, login is handled inside the checkout drawer. Only build custom login UI if your app needs logged-in state outside of checkout (account pages, order history, etc.)
Products & catalog → Use
ce-catalog- Products, variants, SKUs
- Categories, faceted search
- Reviews, recommendations
Cart & checkout → Use
ce-cart-checkout- Hosted Checkout (recommended) — pre-built, embeddable, saves 2-3 months
- Custom checkout (advanced) — Cart CRUD, fulfillment, payment gateways
- Coupons, loyalty points
Orders & returns → Use
ce-orders- Create orders from cart
- Shipment tracking, payment status
- Cancellation, returns flow
Webhooks & events → Use
ce-webhooks- 14 event types (order, payment, refund, shipment)
- Signature verification
- Async processing patterns
Next.js patterns → Use
ce-nextjs-patterns- universal function
storefront() - for SSR
CookieTokenStorage - Server Actions, SSG, ISR
SDK 初始化设置 → 使用
ce-setup- 框架检测与 SDK 安装
- Token 存储方案选择
- 环境变量配置(、
CE_STORE_ID)CE_API_KEY
身份验证与登录 → 使用
ce-auth- 匿名身份验证(必选配置)
- 验证码登录(邮箱/手机号/WhatsApp)、密码验证、Token 刷新
- 注意:如果使用托管结账服务,登录逻辑会在结账弹窗内完成。仅当你的应用需要在结账流程外保留登录状态(如账户页面、订单历史等)时,才需要自定义登录 UI。
商品与类目 → 使用
ce-catalog- 商品、变体、SKU 管理
- 类目、分面搜索
- 评价、商品推荐
购物车与结账 → 使用
ce-cart-checkout- 托管结账(推荐):预制可嵌入的组件,可节省2-3个月的开发时间
- 自定义结账(高级方案):购物车增删改查、履约配置、支付网关对接
- 优惠券、积分抵扣
订单与退换货 → 使用
ce-orders- 基于购物车创建订单
- 物流跟踪、支付状态查询
- 订单取消、退换货流程
Webhook 与事件 → 使用
ce-webhooks- 14种事件类型(订单、支付、退款、物流)
- 签名校验
- 异步处理模式
Next.js 开发模式 → 使用
ce-nextjs-patterns- 通用函数
storefront() - 适配 SSR 的
CookieTokenStorage - Server Actions、SSG、ISR 相关实现
Storefront Pages
店面页面映射
Canonical pages for a CE storefront and the skills/methods each needs:
| Page | Example Route | Skills | Key SDK Methods |
|---|---|---|---|
| Home | | catalog | |
| Product Listing (PLP) | | catalog | |
| Product Detail (PDP) | | catalog | |
| Cart | Hosted Checkout drawer | cart-checkout | |
| Checkout | Hosted Checkout drawer | cart-checkout | |
| Login | | auth | |
| Account | | auth | |
| Orders | | orders | |
| Order Detail | | orders | |
Cart & Checkout routes: With Hosted Checkout (recommended), cart and checkout are drawers — no dedicated pages needed. With custom checkout, addand/cartas separate pages (see/checkout).ce-cart-checkout
Building a new storefront? Start with, then build pages in this order: Home → PLP → PDP → Cart/Checkout → Login → Account → Orders.ce-setupConverting an existing project? Follow the migration checklist below.
CE 店面的标准页面、对应路由、所需技能/核心 SDK 方法如下:
| 页面 | 示例路由 | 所需技能 | 核心 SDK 方法 |
|---|---|---|---|
| 首页 | | catalog | |
| 商品列表页(PLP) | | catalog | 带筛选/搜索的列表页用 |
| 商品详情页(PDP) | | catalog | |
| 购物车 | 托管结账弹窗 | cart-checkout | |
| 结账页 | 托管结账弹窗 | cart-checkout | |
| 登录页 | | auth | |
| 账户中心 | | auth | |
| 订单列表 | | orders | |
| 订单详情 | | orders | |
购物车与结账路由说明:使用推荐的托管结账方案时,购物车和结账都是弹窗形式,不需要单独配置页面。如果使用自定义结账方案,需要新增和/cart独立页面(参考/checkout文档)。ce-cart-checkout
从零搭建新店面? 先从开始,然后按以下顺序开发页面:首页 → 商品列表页 → 商品详情页 → 购物车/结账 → 登录 → 账户中心 → 订单模块。ce-setup迁移现有项目? 参考下方的迁移检查清单。
Converting an Existing Project
现有项目迁移指南
Step-by-step for replacing an existing backend (or mock data) with Commerce Engine:
- Install SDK — Follow . Detect framework, install packages, set env vars, choose token storage.
ce-setup - Add anonymous auth — Call at app startup. Every visitor needs this before any API call works.
sdk.auth.getAnonymousToken() - Replace catalog data — Swap mock/existing product data with calls. Start here because catalog is read-only and low-risk.
sdk.catalog.*- Product lists → or
searchProductslistProducts - Product detail → +
getProductDetaillistProductVariants - Categories →
listCategories
- Product lists →
- Add auth — Replace existing login with CE auth (). Use
ce-auth/loginWithEmail+loginWithPhone.verifyOtp - Add cart + checkout — Install Hosted Checkout (). Replace existing cart UI with
ce-cart-checkouthooks. WireuseCheckout()with two-way token sync.authMode: "provided" - Add orders — Replace order history with /
listOrders(getOrderDetails).ce-orders - Add SEO metadata — Map CE product fields to meta tags (§ "SEO Metadata" for Next.js).
ce-nextjs-patterns
Key principle: Replace one data source at a time. Keep existing UI components — only swap the data layer underneath.
将现有后端(或模拟数据)替换为 Commerce Engine 的分步操作:
- 安装 SDK — 参考 文档,检测项目框架、安装依赖包、配置环境变量、选择 Token 存储方案。
ce-setup - 添加匿名身份验证 — 应用启动时调用 ,所有访客在调用任何API前都需要先获取该Token。
sdk.auth.getAnonymousToken() - 替换类目数据 — 将模拟/原有商品数据替换为 接口调用。建议从该模块开始,因为类目模块是只读的,风险最低。
sdk.catalog.*- 商品列表 → 或
searchProductslistProducts - 商品详情 → +
getProductDetaillistProductVariants - 类目列表 →
listCategories
- 商品列表 →
- 接入身份验证 — 将现有登录逻辑替换为 CE 提供的认证能力(),使用
ce-auth/loginWithEmail+loginWithPhone实现。verifyOtp - 接入购物车+结账 — 安装托管结账能力(),用
ce-cart-checkout钩子替换原有购物车UI,配置useCheckout()实现双向Token同步。authMode: "provided" - 接入订单模块 — 用 /
listOrders替换原有订单历史逻辑(getOrderDetails)。ce-orders - 添加SEO元数据 — 将CE的商品字段映射到页面meta标签(Next.js项目可参考 § "SEO元数据" 部分)。
ce-nextjs-patterns
核心原则:每次只替换一个数据源,保留现有UI组件,仅替换下层的数据层逻辑即可。
Decision Tree
决策树
User Request
│
├─ "Set up SDK" / "Add Commerce Engine" → ce-setup
├─ "Login" / "Auth" / "OTP" → ce-auth
├─ "Products" / "Categories" / "Search" → ce-catalog
├─ "Cart" / "Checkout" / "Payments" → ce-cart-checkout
├─ "Orders" / "Returns" / "Shipments" → ce-orders
├─ "Webhooks" / "Events" / "Sync" → ce-webhooks
└─ "Next.js" / "SSR" / "Server Actions" → ce-nextjs-patternsUser Request
│
├─ "Set up SDK" / "Add Commerce Engine" → ce-setup
├─ "Login" / "Auth" / "OTP" → ce-auth
├─ "Products" / "Categories" / "Search" → ce-catalog
├─ "Cart" / "Checkout" / "Payments" → ce-cart-checkout
├─ "Orders" / "Returns" / "Shipments" → ce-orders
├─ "Webhooks" / "Events" / "Sync" → ce-webhooks
└─ "Next.js" / "SSR" / "Server Actions" → ce-nextjs-patternsQuick Navigation
快速导航
If you know your task, you can directly access:
- - SDK setup & framework detection
/ce-setup - - Authentication & user management
/ce-auth - - Products & categories
/ce-catalog - - Cart, checkout & payments
/ce-cart-checkout - - Order management
/ce-orders - - Webhook events & syncing
/ce-webhooks - - Next.js patterns
/ce-nextjs-patterns
Or describe what you need and I'll recommend the right one.
如果你明确自己的任务,可以直接访问对应模块:
- - SDK 初始化与框架检测
/ce-setup - - 身份验证与用户管理
/ce-auth - - 商品与类目管理
/ce-catalog - - 购物车、结账与支付
/ce-cart-checkout - - 订单管理
/ce-orders - - Webhook 事件与同步
/ce-webhooks - - Next.js 开发模式
/ce-nextjs-patterns
或者描述你的需求,我会为你推荐合适的模块。