creating-b2b-commerce-store

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. 导航至 设置 → Commerce → 店铺
    • 或者:应用启动器 → Commerce → 创建店铺
  2. 点击 "创建店铺""设置新店铺"
  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_*, 等)
├── 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
先创建店铺(生成店铺前端)→ 检索 → 定制