commerce-b2b-store-create

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commerce B2B Storefront Creation

Commerce B2B 店面创建

Interactive workflow to create a Commerce B2B Store in Salesforce and retrieve the auto-generated storefront metadata to your repository.
用于在Salesforce中创建Commerce B2B商店并将自动生成的店面元数据检索到你的代码仓库的交互式工作流。

Critical Concepts

核心概念

Commerce B2B = Store (backend data) + Storefront (frontend metadata). Store must be created first in the org to auto-generate the Storefront. Never create storefront metadata manually.
See Store vs Storefront Reference
Commerce B2B = 商店(后端数据) + 店面(前端元数据)。必须先在组织中创建商店,才能自动生成店面。切勿手动创建店面元数据。
参考:商店与店面对比文档

When to Use This Skill

何时使用此技能

Trigger when users request:
  • "Create a B2B Commerce store"
  • "Build a Commerce storefront"
  • "Set up Commerce B2B"
  • "Create B2B Commerce"
  • "Retrieve Commerce storefront metadata"
  • "Deploy B2B storefront"
当用户提出以下需求时触发:
  • "创建B2B Commerce商店"
  • "构建Commerce店面"
  • "设置Commerce B2B"
  • "创建B2B Commerce"
  • "检索Commerce店面元数据"
  • "部署B2B店面"

Rules That Always Apply

必须遵循的规则

  1. Always follow the interactive flow. Do NOT skip steps. Each step requires user confirmation before proceeding.
  2. Never create storefront metadata manually. The Commerce setup wizard generates hundreds of configuration values. Manual creation will fail.
  3. Always list sites before retrieval. Store names get underscores and number suffixes (e.g., "My B2B Store" → "My_B2B_Store1"). Let the user select from the actual list.
  4. Always use
    --json
    flag.
    Include
    --json
    on all Salesforce CLI commands for parseable output.
  1. 始终遵循交互式流程。请勿跳过步骤。每个步骤都需要用户确认后才能继续。
  2. 切勿手动创建店面元数据。Commerce设置向导会生成数百个配置值,手动创建会失败。
  3. 检索前务必列出站点。商店名称会转换为下划线加数字后缀的格式(例如:"My B2B Store" → "My_B2B_Store1")。让用户从实际列表中选择。
  4. 始终使用
    --json
    参数
    。所有Salesforce CLI命令都要加上
    --json
    ,以生成可解析的输出。

Interactive Workflow: 7 Steps

交互式工作流:7个步骤

Step 1: Explain Commerce B2B Concept

步骤1:讲解Commerce B2B概念

Agent explains: Commerce has Store (data) + Storefront (metadata). Store must be created first.
See: Store vs Storefront Reference

Agent说明: Commerce包含商店(数据)+店面(元数据),必须先创建商店。
参考:商店与店面对比文档

Step 2: Guide User to Create B2B Store

步骤2:引导用户创建B2B商店

Agent provides these steps:
  1. Navigate to Setup → Commerce → Stores
    • Or: App Launcher → Commerce → Create Store
  2. Click "Create Store" or "Setup New Store"
  3. Select "Commerce Store" as the store type
  4. Follow the wizard:
    • Store Name: Choose descriptive name (e.g., "My B2B Store")
      • Important: Spaces become underscores in folder names
    • Site URL: Unique URL name for the site
  5. Complete wizard - it creates:
    • WebStore record
    • Default buyer group and entitlement policies
    • Associated Digital Experience (LWR site)
  6. Optional: Configure payment gateway, tax provider, shipping
Agent then asks: "Have you completed creating the B2B Store in your org? Reply 'yes' when ready and provide the store name you used."

Agent提供以下步骤:
  1. 导航至 Setup → Commerce → Stores
    • 或者:App Launcher → Commerce → Create Store
  2. 点击 "Create Store""Setup New Store"
  3. 选择 "Commerce Store" 作为商店类型
  4. 按照向导操作:
    • 商店名称:选择具有描述性的名称(例如:"My B2B Store")
      • 注意:名称中的空格会在文件夹名称中变为下划线
    • 站点URL:为站点设置唯一的URL名称
  5. 完成向导后,将创建以下内容:
    • WebStore记录
    • 默认买方组和权限策略
    • 关联的Digital Experience(LWR站点)
  6. 可选操作:配置支付网关、税务提供商、物流
Agent随后询问: "你是否已在组织中完成B2B商店的创建?准备好后回复'yes'并提供你使用的商店名称。"

Step 3: Get User Confirmation

步骤3:获取用户确认

Agent waits for: User confirmation and store name
Agent validates: Store name format (no special characters, spaces will appear as underscores)
Agent acknowledges: "Great! Let me list the available storefronts in your org..."

Agent等待: 用户确认及商店名称
Agent验证: 商店名称格式(无特殊字符,空格会显示为下划线)
Agent回复: "好的!我现在列出你组织中可用的店面..."

Step 4: List Available LWR Sites

步骤4:列出可用的LWR站点

Agent executes:
bash
sf org list metadata --metadata-type DigitalExperienceConfig --json
Agent should:
  • Parse JSON output to extract site names
  • Display as numbered list
  • Explain naming (underscores, number suffixes)
Example output:
Available Digital Experience sites:
1. My_B2B_Store1
2. Partner_Portal
3. Customer_Community

Agent执行:
bash
sf org list metadata --metadata-type DigitalExperienceConfig --json
Agent需执行:
  • 解析JSON输出以提取站点名称
  • 以编号列表形式展示
  • 说明命名规则(下划线、数字后缀)
示例输出:
可用的Digital Experience站点:
1. My_B2B_Store1
2. Partner_Portal
3. Customer_Community

Step 5: Let User Select Storefront

步骤5:让用户选择店面

Agent asks: "Which site corresponds to your B2B Store? Select the site name:"
Agent validates: Selection matches available sites
Agent confirms: "Got it! I'll retrieve metadata for [site-name]..."

Agent询问: "哪个站点对应你的B2B商店?请选择站点名称:"
Agent验证: 用户选择的站点在可用列表中
Agent确认: "收到!我将检索[站点名称]的元数据..."

Step 6: Retrieve Storefront Metadata

步骤6:检索店面元数据

Agent executes:
bash
sf project retrieve start -m DigitalExperienceBundle:site/<selected-store-name> --json
Agent should:
  • Show retrieval progress
  • Confirm successful retrieval
  • List retrieved directory structure
Expected output:
Retrieved: force-app/main/default/digitalExperiences/site/My_B2B_Store1/
├── My_B2B_Store1.digitalExperience-meta.xml
├── sfdc_cms__view/ (home, current_cart, detail_*, list_*, etc.)
├── sfdc_cms__site/
├── sfdc_cms__route/
└── [other sfdc_cms__* directories]

Agent执行:
bash
sf project retrieve start -m DigitalExperienceBundle:site/<selected-store-name> --json
Agent需执行:
  • 展示检索进度
  • 确认检索成功
  • 列出检索到的目录结构
预期输出:
已检索到:force-app/main/default/digitalExperiences/site/My_B2B_Store1/
├── My_B2B_Store1.digitalExperience-meta.xml
├── sfdc_cms__view/ (home, current_cart, detail_*, list_*, etc.)
├── sfdc_cms__site/
├── sfdc_cms__route/
└── [其他sfdc_cms__*目录]

Step 7: Provide Next Steps

步骤7:提供后续步骤

Agent provides:
Metadata retrieved successfully!
Next steps:
  • Customize with custom LWCs or branding changes
  • Deploy:
    sf project deploy start --source-dir force-app/main/default/digitalExperiences/site/My_B2B_Store1/ --json

Agent提供:
元数据检索成功!
后续步骤:
  • 使用自定义LWC或品牌变更进行定制
  • 部署:
    sf project deploy start --source-dir force-app/main/default/digitalExperiences/site/My_B2B_Store1/ --json

Reference

参考

  • store-vs-storefront.md - Technical details on Store vs Storefront, source control, and why manual creation fails

  • store-vs-storefront.md - 关于商店与店面、源代码控制以及手动创建失败原因的技术细节

Remember

记住

Store first (creates storefront) → Retrieve → Customize
先创建商店(自动生成店面)→ 检索元数据 → 定制