[ PROMPT_NODE_28030 ]
shopify-development
[ SKILL_DOCUMENTATION ]
# Shopify 开发技能
当用户询问以下内容时使用此技能:
- 构建 Shopify 应用或扩展
- 创建结账/管理后台/POS UI 自定义
- 使用 Liquid 模板开发主题
- 集成 Shopify GraphQL 或 REST API
- 实现 Webhook 或账单功能
- 处理元字段 (Metafields) 或 Shopify Functions
---
## 路由:构建什么
**如果用户想要集成外部服务 OR 构建商家工具 OR 对功能收费:**
→ 构建一个 **应用** (参见 `references/app-development.md`)
**如果用户想要自定义结账 OR 添加管理后台 UI OR 创建 POS 操作 OR 实现折扣规则:**
→ 构建一个 **扩展** (参见 `references/extensions.md`)
**如果用户想要自定义店面设计 OR 修改产品/集合页面:**
→ 构建一个 **主题** (参见 `references/themes.md`)
**如果用户同时需要后端逻辑 AND 店面 UI:**
→ 构建 **应用 + 主题扩展** 组合
---
## Shopify CLI 命令
安装 CLI:
bash
npm install -g @shopify/cli@latest
创建并运行应用:
bash
shopify app init # 创建新应用
shopify app dev # 启动带隧道的开发服务器
shopify app deploy # 构建并上传至 Shopify
生成扩展:
bash
shopify app generate extension --type checkout_ui_extension
shopify app generate extension --type admin_action
shopify app generate extension --type admin_block
shopify app generate extension --type pos_ui_extension
shopify app generate extension --type function
主题开发:
bash
shopify theme init # 创建新主题
shopify theme dev # 在 localhost:9292 启动本地预览
shopify theme pull --live # 拉取线上主题
shopify theme push --development # 推送至开发主题
---
## 访问范围 (Access Scopes)
在 `shopify.app.toml` 中配置:
toml
[access_scopes]
scopes = "read_products,write_products,read_orders,write_orders,read_customers"
常用范围:
- `read_products`, `write_products` - 产品目录访问
- `read_orders`, `write_orders` - 订单管理
- `read_customers`, `write_customers` - 客户数据
- `read_inventory`, `write_inventory` - 库存水平
- `read_fulfillments`, `write_fulfillments` - 订单履行
---
## GraphQL 模式 (已针对 API 2026-01 验证)
### 查询产品
graphql
query GetProducts($first: Int!, $query: String) {
products(first: $first, query: $query) {
edges {
node {
id
title
handle
status
variants(first: 5) {