shopify-starter-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/skills/shopify-apps/SKILL.md +47 -0
- package/.agent/skills/shopify-automation/SKILL.md +172 -0
- package/.agent/skills/shopify-development/README.md +60 -0
- package/.agent/skills/shopify-development/SKILL.md +368 -0
- package/.agent/skills/shopify-development/references/app-development.md +578 -0
- package/.agent/skills/shopify-development/references/extensions.md +555 -0
- package/.agent/skills/shopify-development/references/themes.md +498 -0
- package/.agent/skills/shopify-development/scripts/requirements.txt +19 -0
- package/.agent/skills/shopify-development/scripts/shopify_graphql.py +428 -0
- package/.agent/skills/shopify-development/scripts/shopify_init.py +441 -0
- package/.agent/skills/shopify-development/scripts/tests/test_shopify_init.py +379 -0
- package/bin/cli.js +3 -0
- package/package.json +32 -0
- package/src/index.js +116 -0
- package/templates/.agent/skills/shopify-apps/SKILL.md +47 -0
- package/templates/.agent/skills/shopify-automation/SKILL.md +172 -0
- package/templates/.agent/skills/shopify-development/README.md +60 -0
- package/templates/.agent/skills/shopify-development/SKILL.md +368 -0
- package/templates/.agent/skills/shopify-development/references/app-development.md +578 -0
- package/templates/.agent/skills/shopify-development/references/extensions.md +555 -0
- package/templates/.agent/skills/shopify-development/references/themes.md +498 -0
- package/templates/.agent/skills/shopify-development/scripts/requirements.txt +19 -0
- package/templates/.agent/skills/shopify-development/scripts/shopify_graphql.py +428 -0
- package/templates/.agent/skills/shopify-development/scripts/shopify_init.py +441 -0
- package/templates/.agent/skills/shopify-development/scripts/tests/test_shopify_init.py +379 -0
- package/templates/.devcontainer/devcontainer.json +27 -0
- package/templates/tests/playwright.config.ts +26 -0
- package/templates/tests/vitest.config.ts +9 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shopify-apps
|
|
3
|
+
description: "Expert patterns for Shopify app development including Remix/React Router apps, embedded apps with App Bridge, webhook handling, GraphQL Admin API, Polaris components, billing, and app extensions. U..."
|
|
4
|
+
risk: unknown
|
|
5
|
+
source: "vibeship-spawner-skills (Apache 2.0)"
|
|
6
|
+
date_added: "2026-02-27"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Shopify Apps
|
|
10
|
+
|
|
11
|
+
## Patterns
|
|
12
|
+
|
|
13
|
+
### React Router App Setup
|
|
14
|
+
|
|
15
|
+
Modern Shopify app template with React Router
|
|
16
|
+
|
|
17
|
+
### Embedded App with App Bridge
|
|
18
|
+
|
|
19
|
+
Render app embedded in Shopify Admin
|
|
20
|
+
|
|
21
|
+
### Webhook Handling
|
|
22
|
+
|
|
23
|
+
Secure webhook processing with HMAC verification
|
|
24
|
+
|
|
25
|
+
## Anti-Patterns
|
|
26
|
+
|
|
27
|
+
### ❌ REST API for New Apps
|
|
28
|
+
|
|
29
|
+
### ❌ Webhook Processing Before Response
|
|
30
|
+
|
|
31
|
+
### ❌ Polling Instead of Webhooks
|
|
32
|
+
|
|
33
|
+
## ⚠️ Sharp Edges
|
|
34
|
+
|
|
35
|
+
| Issue | Severity | Solution |
|
|
36
|
+
|-------|----------|----------|
|
|
37
|
+
| Issue | high | ## Respond immediately, process asynchronously |
|
|
38
|
+
| Issue | high | ## Check rate limit headers |
|
|
39
|
+
| Issue | high | ## Request protected customer data access |
|
|
40
|
+
| Issue | medium | ## Use TOML only (recommended) |
|
|
41
|
+
| Issue | medium | ## Handle both URL formats |
|
|
42
|
+
| Issue | high | ## Use GraphQL for all new code |
|
|
43
|
+
| Issue | high | ## Use latest App Bridge via script tag |
|
|
44
|
+
| Issue | high | ## Implement all GDPR handlers |
|
|
45
|
+
|
|
46
|
+
## When to Use
|
|
47
|
+
This skill is applicable to execute the workflow or actions described in the overview.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shopify-automation
|
|
3
|
+
description: "Automate Shopify tasks via Rube MCP (Composio): products, orders, customers, inventory, collections. Always search tools first for current schemas."
|
|
4
|
+
risk: unknown
|
|
5
|
+
source: community
|
|
6
|
+
date_added: "2026-02-27"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Shopify Automation via Rube MCP
|
|
10
|
+
|
|
11
|
+
Automate Shopify operations through Composio's Shopify toolkit via Rube MCP.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
|
|
16
|
+
- Active Shopify connection via `RUBE_MANAGE_CONNECTIONS` with toolkit `shopify`
|
|
17
|
+
- Always call `RUBE_SEARCH_TOOLS` first to get current tool schemas
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
**Get Rube MCP**: Add `https://rube.app/mcp` as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
1. Verify Rube MCP is available by confirming `RUBE_SEARCH_TOOLS` responds
|
|
25
|
+
2. Call `RUBE_MANAGE_CONNECTIONS` with toolkit `shopify`
|
|
26
|
+
3. If connection is not ACTIVE, follow the returned auth link to complete Shopify OAuth
|
|
27
|
+
4. Confirm connection status shows ACTIVE before running any workflows
|
|
28
|
+
|
|
29
|
+
## Core Workflows
|
|
30
|
+
|
|
31
|
+
### 1. Manage Products
|
|
32
|
+
|
|
33
|
+
**When to use**: User wants to list, search, create, or manage products
|
|
34
|
+
|
|
35
|
+
**Tool sequence**:
|
|
36
|
+
1. `SHOPIFY_GET_PRODUCTS` / `SHOPIFY_GET_PRODUCTS_PAGINATED` - List products [Optional]
|
|
37
|
+
2. `SHOPIFY_GET_PRODUCT` - Get single product details [Optional]
|
|
38
|
+
3. `SHOPIFY_BULK_CREATE_PRODUCTS` - Create products in bulk [Optional]
|
|
39
|
+
4. `SHOPIFY_GET_PRODUCTS_COUNT` - Get product count [Optional]
|
|
40
|
+
|
|
41
|
+
**Key parameters**:
|
|
42
|
+
- `product_id`: Product ID for single retrieval
|
|
43
|
+
- `title`: Product title
|
|
44
|
+
- `vendor`: Product vendor
|
|
45
|
+
- `status`: 'active', 'draft', or 'archived'
|
|
46
|
+
|
|
47
|
+
**Pitfalls**:
|
|
48
|
+
- Paginated results require cursor-based pagination for large catalogs
|
|
49
|
+
- Product variants are nested within the product object
|
|
50
|
+
|
|
51
|
+
### 2. Manage Orders
|
|
52
|
+
|
|
53
|
+
**When to use**: User wants to list, search, or inspect orders
|
|
54
|
+
|
|
55
|
+
**Tool sequence**:
|
|
56
|
+
1. `SHOPIFY_GET_ORDERS_WITH_FILTERS` - List orders with filters [Required]
|
|
57
|
+
2. `SHOPIFY_GET_ORDER` - Get single order details [Optional]
|
|
58
|
+
3. `SHOPIFY_GET_FULFILLMENT` - Get fulfillment details [Optional]
|
|
59
|
+
4. `SHOPIFY_GET_FULFILLMENT_EVENTS` - Track fulfillment events [Optional]
|
|
60
|
+
|
|
61
|
+
**Key parameters**:
|
|
62
|
+
- `status`: Order status filter ('any', 'open', 'closed', 'cancelled')
|
|
63
|
+
- `financial_status`: Payment status filter
|
|
64
|
+
- `fulfillment_status`: Fulfillment status filter
|
|
65
|
+
- `order_id`: Order ID for single retrieval
|
|
66
|
+
- `created_at_min`/`created_at_max`: Date range filters
|
|
67
|
+
|
|
68
|
+
**Pitfalls**:
|
|
69
|
+
- Order IDs are numeric; use string format for API calls
|
|
70
|
+
- Default order listing may not include all statuses; specify 'any' for all
|
|
71
|
+
|
|
72
|
+
### 3. Manage Customers
|
|
73
|
+
|
|
74
|
+
**When to use**: User wants to list or search customers
|
|
75
|
+
|
|
76
|
+
**Tool sequence**:
|
|
77
|
+
1. `SHOPIFY_GET_ALL_CUSTOMERS` - List all customers [Required]
|
|
78
|
+
|
|
79
|
+
**Key parameters**:
|
|
80
|
+
- `limit`: Number of customers per page
|
|
81
|
+
- `since_id`: Pagination cursor
|
|
82
|
+
|
|
83
|
+
**Pitfalls**:
|
|
84
|
+
- Customer data includes order count and total spent
|
|
85
|
+
- Large customer lists require pagination
|
|
86
|
+
|
|
87
|
+
### 4. Manage Collections
|
|
88
|
+
|
|
89
|
+
**When to use**: User wants to manage product collections
|
|
90
|
+
|
|
91
|
+
**Tool sequence**:
|
|
92
|
+
1. `SHOPIFY_GET_SMART_COLLECTIONS` - List smart collections [Optional]
|
|
93
|
+
2. `SHOPIFY_GET_SMART_COLLECTION_BY_ID` - Get collection details [Optional]
|
|
94
|
+
3. `SHOPIFY_CREATE_SMART_COLLECTIONS` - Create a smart collection [Optional]
|
|
95
|
+
4. `SHOPIFY_ADD_PRODUCT_TO_COLLECTION` - Add product to collection [Optional]
|
|
96
|
+
5. `SHOPIFY_GET_PRODUCTS_IN_COLLECTION` - List products in collection [Optional]
|
|
97
|
+
|
|
98
|
+
**Key parameters**:
|
|
99
|
+
- `collection_id`: Collection ID
|
|
100
|
+
- `product_id`: Product ID for adding to collection
|
|
101
|
+
- `rules`: Smart collection rules for automatic inclusion
|
|
102
|
+
|
|
103
|
+
**Pitfalls**:
|
|
104
|
+
- Smart collections auto-populate based on rules; manual collections use custom collections API
|
|
105
|
+
- Collection count endpoints provide approximate counts
|
|
106
|
+
|
|
107
|
+
### 5. Manage Inventory
|
|
108
|
+
|
|
109
|
+
**When to use**: User wants to check or manage inventory levels
|
|
110
|
+
|
|
111
|
+
**Tool sequence**:
|
|
112
|
+
1. `SHOPIFY_GET_INVENTORY_LEVELS` / `SHOPIFY_RETRIEVES_A_LIST_OF_INVENTORY_LEVELS` - Check stock [Required]
|
|
113
|
+
2. `SHOPIFY_LIST_LOCATION` - List store locations [Optional]
|
|
114
|
+
|
|
115
|
+
**Key parameters**:
|
|
116
|
+
- `inventory_item_ids`: Inventory item IDs to check
|
|
117
|
+
- `location_ids`: Location IDs to filter by
|
|
118
|
+
|
|
119
|
+
**Pitfalls**:
|
|
120
|
+
- Inventory is tracked per variant per location
|
|
121
|
+
- Location IDs are required for multi-location stores
|
|
122
|
+
|
|
123
|
+
## Common Patterns
|
|
124
|
+
|
|
125
|
+
### Pagination
|
|
126
|
+
|
|
127
|
+
- Use `limit` and `page_info` cursor for paginated results
|
|
128
|
+
- Check response for `next` link header
|
|
129
|
+
- Continue until no more pages available
|
|
130
|
+
|
|
131
|
+
### GraphQL Queries
|
|
132
|
+
|
|
133
|
+
For advanced operations:
|
|
134
|
+
```
|
|
135
|
+
1. Call SHOPIFY_GRAPH_QL_QUERY with custom query
|
|
136
|
+
2. Parse response from data object
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Known Pitfalls
|
|
140
|
+
|
|
141
|
+
**API Versioning**:
|
|
142
|
+
- Shopify REST API has versioned endpoints
|
|
143
|
+
- Some features require specific API versions
|
|
144
|
+
|
|
145
|
+
**Rate Limits**:
|
|
146
|
+
- REST API: 2 requests/second for standard plans
|
|
147
|
+
- GraphQL: 1000 cost points per second
|
|
148
|
+
|
|
149
|
+
## Quick Reference
|
|
150
|
+
|
|
151
|
+
| Task | Tool Slug | Key Params |
|
|
152
|
+
|------|-----------|------------|
|
|
153
|
+
| List products | SHOPIFY_GET_PRODUCTS | (filters) |
|
|
154
|
+
| Get product | SHOPIFY_GET_PRODUCT | product_id |
|
|
155
|
+
| Products paginated | SHOPIFY_GET_PRODUCTS_PAGINATED | limit, page_info |
|
|
156
|
+
| Bulk create | SHOPIFY_BULK_CREATE_PRODUCTS | products |
|
|
157
|
+
| Product count | SHOPIFY_GET_PRODUCTS_COUNT | (none) |
|
|
158
|
+
| List orders | SHOPIFY_GET_ORDERS_WITH_FILTERS | status, financial_status |
|
|
159
|
+
| Get order | SHOPIFY_GET_ORDER | order_id |
|
|
160
|
+
| List customers | SHOPIFY_GET_ALL_CUSTOMERS | limit |
|
|
161
|
+
| Shop details | SHOPIFY_GET_SHOP_DETAILS | (none) |
|
|
162
|
+
| Validate access | SHOPIFY_VALIDATE_ACCESS | (none) |
|
|
163
|
+
| Smart collections | SHOPIFY_GET_SMART_COLLECTIONS | (none) |
|
|
164
|
+
| Products in collection | SHOPIFY_GET_PRODUCTS_IN_COLLECTION | collection_id |
|
|
165
|
+
| Inventory levels | SHOPIFY_GET_INVENTORY_LEVELS | inventory_item_ids |
|
|
166
|
+
| Locations | SHOPIFY_LIST_LOCATION | (none) |
|
|
167
|
+
| Fulfillment | SHOPIFY_GET_FULFILLMENT | order_id, fulfillment_id |
|
|
168
|
+
| GraphQL | SHOPIFY_GRAPH_QL_QUERY | query |
|
|
169
|
+
| Bulk query | SHOPIFY_BULK_QUERY_OPERATION | query |
|
|
170
|
+
|
|
171
|
+
## When to Use
|
|
172
|
+
This skill is applicable to execute the workflow or actions described in the overview.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Shopify Development Skill
|
|
2
|
+
|
|
3
|
+
Comprehensive skill for building on Shopify platform: apps, extensions, themes, and API integrations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **App Development** - OAuth authentication, GraphQL Admin API, webhooks, billing integration
|
|
8
|
+
- **UI Extensions** - Checkout, Admin, POS customizations with Polaris components
|
|
9
|
+
- **Theme Development** - Liquid templating, sections, snippets
|
|
10
|
+
- **Shopify Functions** - Custom discounts, payment, delivery rules
|
|
11
|
+
|
|
12
|
+
## Structure
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
shopify-development/
|
|
16
|
+
├── SKILL.md # Main skill file (AI-optimized)
|
|
17
|
+
├── README.md # This file
|
|
18
|
+
├── references/
|
|
19
|
+
│ ├── app-development.md # OAuth, API, webhooks, billing
|
|
20
|
+
│ ├── extensions.md # UI extensions, Functions
|
|
21
|
+
│ └── themes.md # Liquid, theme architecture
|
|
22
|
+
└── scripts/
|
|
23
|
+
├── shopify_init.py # Interactive project scaffolding
|
|
24
|
+
├── shopify_graphql.py # GraphQL utilities & templates
|
|
25
|
+
└── tests/ # Unit tests
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Validated GraphQL
|
|
29
|
+
|
|
30
|
+
All GraphQL queries and mutations in this skill have been validated against Shopify Admin API 2026-01 schema using the official Shopify MCP.
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Install Shopify CLI
|
|
36
|
+
npm install -g @shopify/cli@latest
|
|
37
|
+
|
|
38
|
+
# Create new app
|
|
39
|
+
shopify app init
|
|
40
|
+
|
|
41
|
+
# Start development
|
|
42
|
+
shopify app dev
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage Triggers
|
|
46
|
+
|
|
47
|
+
This skill activates when the user mentions:
|
|
48
|
+
|
|
49
|
+
- "shopify app", "shopify extension", "shopify theme"
|
|
50
|
+
- "checkout extension", "admin extension", "POS extension"
|
|
51
|
+
- "liquid template", "polaris", "shopify graphql"
|
|
52
|
+
- "shopify webhook", "shopify billing", "metafields"
|
|
53
|
+
|
|
54
|
+
## API Version
|
|
55
|
+
|
|
56
|
+
Current: **2026-01** (Quarterly releases with 12-month support)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shopify-development
|
|
3
|
+
description: Build Shopify apps, extensions, themes using GraphQL Admin API, Shopify CLI, Polaris UI, and Liquid.
|
|
4
|
+
risk: unknown
|
|
5
|
+
source: community
|
|
6
|
+
date_added: '2026-02-27'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Shopify Development Skill
|
|
10
|
+
|
|
11
|
+
Use this skill when the user asks about:
|
|
12
|
+
|
|
13
|
+
- Building Shopify apps or extensions
|
|
14
|
+
- Creating checkout/admin/POS UI customizations
|
|
15
|
+
- Developing themes with Liquid templating
|
|
16
|
+
- Integrating with Shopify GraphQL or REST APIs
|
|
17
|
+
- Implementing webhooks or billing
|
|
18
|
+
- Working with metafields or Shopify Functions
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## ROUTING: What to Build
|
|
23
|
+
|
|
24
|
+
**IF user wants to integrate external services OR build merchant tools OR charge for features:**
|
|
25
|
+
→ Build an **App** (see `references/app-development.md`)
|
|
26
|
+
|
|
27
|
+
**IF user wants to customize checkout OR add admin UI OR create POS actions OR implement discount rules:**
|
|
28
|
+
→ Build an **Extension** (see `references/extensions.md`)
|
|
29
|
+
|
|
30
|
+
**IF user wants to customize storefront design OR modify product/collection pages:**
|
|
31
|
+
→ Build a **Theme** (see `references/themes.md`)
|
|
32
|
+
|
|
33
|
+
**IF user needs both backend logic AND storefront UI:**
|
|
34
|
+
→ Build **App + Theme Extension** combination
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Shopify CLI Commands
|
|
39
|
+
|
|
40
|
+
Install CLI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g @shopify/cli@latest
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Create and run app:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
shopify app init # Create new app
|
|
50
|
+
shopify app dev # Start dev server with tunnel
|
|
51
|
+
shopify app deploy # Build and upload to Shopify
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Generate extension:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
shopify app generate extension --type checkout_ui_extension
|
|
58
|
+
shopify app generate extension --type admin_action
|
|
59
|
+
shopify app generate extension --type admin_block
|
|
60
|
+
shopify app generate extension --type pos_ui_extension
|
|
61
|
+
shopify app generate extension --type function
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Theme development:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
shopify theme init # Create new theme
|
|
68
|
+
shopify theme dev # Start local preview at localhost:9292
|
|
69
|
+
shopify theme pull --live # Pull live theme
|
|
70
|
+
shopify theme push --development # Push to dev theme
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Access Scopes
|
|
76
|
+
|
|
77
|
+
Configure in `shopify.app.toml`:
|
|
78
|
+
|
|
79
|
+
```toml
|
|
80
|
+
[access_scopes]
|
|
81
|
+
scopes = "read_products,write_products,read_orders,write_orders,read_customers"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Common scopes:
|
|
85
|
+
|
|
86
|
+
- `read_products`, `write_products` - Product catalog access
|
|
87
|
+
- `read_orders`, `write_orders` - Order management
|
|
88
|
+
- `read_customers`, `write_customers` - Customer data
|
|
89
|
+
- `read_inventory`, `write_inventory` - Stock levels
|
|
90
|
+
- `read_fulfillments`, `write_fulfillments` - Order fulfillment
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## GraphQL Patterns (Validated against API 2026-01)
|
|
95
|
+
|
|
96
|
+
### Query Products
|
|
97
|
+
|
|
98
|
+
```graphql
|
|
99
|
+
query GetProducts($first: Int!, $query: String) {
|
|
100
|
+
products(first: $first, query: $query) {
|
|
101
|
+
edges {
|
|
102
|
+
node {
|
|
103
|
+
id
|
|
104
|
+
title
|
|
105
|
+
handle
|
|
106
|
+
status
|
|
107
|
+
variants(first: 5) {
|
|
108
|
+
edges {
|
|
109
|
+
node {
|
|
110
|
+
id
|
|
111
|
+
price
|
|
112
|
+
inventoryQuantity
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
pageInfo {
|
|
119
|
+
hasNextPage
|
|
120
|
+
endCursor
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Query Orders
|
|
127
|
+
|
|
128
|
+
```graphql
|
|
129
|
+
query GetOrders($first: Int!) {
|
|
130
|
+
orders(first: $first) {
|
|
131
|
+
edges {
|
|
132
|
+
node {
|
|
133
|
+
id
|
|
134
|
+
name
|
|
135
|
+
createdAt
|
|
136
|
+
displayFinancialStatus
|
|
137
|
+
totalPriceSet {
|
|
138
|
+
shopMoney {
|
|
139
|
+
amount
|
|
140
|
+
currencyCode
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Set Metafields
|
|
150
|
+
|
|
151
|
+
```graphql
|
|
152
|
+
mutation SetMetafields($metafields: [MetafieldsSetInput!]!) {
|
|
153
|
+
metafieldsSet(metafields: $metafields) {
|
|
154
|
+
metafields {
|
|
155
|
+
id
|
|
156
|
+
namespace
|
|
157
|
+
key
|
|
158
|
+
value
|
|
159
|
+
}
|
|
160
|
+
userErrors {
|
|
161
|
+
field
|
|
162
|
+
message
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Variables example:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"metafields": [
|
|
173
|
+
{
|
|
174
|
+
"ownerId": "gid://shopify/Product/123",
|
|
175
|
+
"namespace": "custom",
|
|
176
|
+
"key": "care_instructions",
|
|
177
|
+
"value": "Handle with care",
|
|
178
|
+
"type": "single_line_text_field"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Checkout Extension Example
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import {
|
|
190
|
+
reactExtension,
|
|
191
|
+
BlockStack,
|
|
192
|
+
TextField,
|
|
193
|
+
Checkbox,
|
|
194
|
+
useApplyAttributeChange,
|
|
195
|
+
} from "@shopify/ui-extensions-react/checkout";
|
|
196
|
+
|
|
197
|
+
export default reactExtension("purchase.checkout.block.render", () => (
|
|
198
|
+
<GiftMessage />
|
|
199
|
+
));
|
|
200
|
+
|
|
201
|
+
function GiftMessage() {
|
|
202
|
+
const [isGift, setIsGift] = useState(false);
|
|
203
|
+
const [message, setMessage] = useState("");
|
|
204
|
+
const applyAttributeChange = useApplyAttributeChange();
|
|
205
|
+
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (isGift && message) {
|
|
208
|
+
applyAttributeChange({
|
|
209
|
+
type: "updateAttribute",
|
|
210
|
+
key: "gift_message",
|
|
211
|
+
value: message,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}, [isGift, message]);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<BlockStack spacing="loose">
|
|
218
|
+
<Checkbox checked={isGift} onChange={setIsGift}>
|
|
219
|
+
This is a gift
|
|
220
|
+
</Checkbox>
|
|
221
|
+
{isGift && (
|
|
222
|
+
<TextField
|
|
223
|
+
label="Gift Message"
|
|
224
|
+
value={message}
|
|
225
|
+
onChange={setMessage}
|
|
226
|
+
multiline={3}
|
|
227
|
+
/>
|
|
228
|
+
)}
|
|
229
|
+
</BlockStack>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Liquid Template Example
|
|
237
|
+
|
|
238
|
+
```liquid
|
|
239
|
+
{% comment %} Product Card Snippet {% endcomment %}
|
|
240
|
+
<div class="product-card">
|
|
241
|
+
<a href="{{ product.url }}">
|
|
242
|
+
{% if product.featured_image %}
|
|
243
|
+
<img
|
|
244
|
+
src="{{ product.featured_image | img_url: 'medium' }}"
|
|
245
|
+
alt="{{ product.title | escape }}"
|
|
246
|
+
loading="lazy"
|
|
247
|
+
>
|
|
248
|
+
{% endif %}
|
|
249
|
+
<h3>{{ product.title }}</h3>
|
|
250
|
+
<p class="price">{{ product.price | money }}</p>
|
|
251
|
+
{% if product.compare_at_price > product.price %}
|
|
252
|
+
<p class="sale-badge">Sale</p>
|
|
253
|
+
{% endif %}
|
|
254
|
+
</a>
|
|
255
|
+
</div>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Webhook Configuration
|
|
261
|
+
|
|
262
|
+
In `shopify.app.toml`:
|
|
263
|
+
|
|
264
|
+
```toml
|
|
265
|
+
[webhooks]
|
|
266
|
+
api_version = "2026-01"
|
|
267
|
+
|
|
268
|
+
[[webhooks.subscriptions]]
|
|
269
|
+
topics = ["orders/create", "orders/updated"]
|
|
270
|
+
uri = "/webhooks/orders"
|
|
271
|
+
|
|
272
|
+
[[webhooks.subscriptions]]
|
|
273
|
+
topics = ["products/update"]
|
|
274
|
+
uri = "/webhooks/products"
|
|
275
|
+
|
|
276
|
+
# GDPR mandatory webhooks (required for app approval)
|
|
277
|
+
[webhooks.privacy_compliance]
|
|
278
|
+
customer_data_request_url = "/webhooks/gdpr/data-request"
|
|
279
|
+
customer_deletion_url = "/webhooks/gdpr/customer-deletion"
|
|
280
|
+
shop_deletion_url = "/webhooks/gdpr/shop-deletion"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Best Practices
|
|
286
|
+
|
|
287
|
+
### API Usage
|
|
288
|
+
|
|
289
|
+
- Use GraphQL over REST for new development
|
|
290
|
+
- Request only fields you need (reduces query cost)
|
|
291
|
+
- Implement cursor-based pagination with `pageInfo.endCursor`
|
|
292
|
+
- Use bulk operations for processing more than 250 items
|
|
293
|
+
- Handle rate limits with exponential backoff
|
|
294
|
+
|
|
295
|
+
### Security
|
|
296
|
+
|
|
297
|
+
- Store API credentials in environment variables
|
|
298
|
+
- Always verify webhook HMAC signatures before processing
|
|
299
|
+
- Validate OAuth state parameter to prevent CSRF
|
|
300
|
+
- Request minimal access scopes
|
|
301
|
+
- Use session tokens for embedded apps
|
|
302
|
+
|
|
303
|
+
### Performance
|
|
304
|
+
|
|
305
|
+
- Cache API responses when data doesn't change frequently
|
|
306
|
+
- Use lazy loading in extensions
|
|
307
|
+
- Optimize images in themes using `img_url` filter
|
|
308
|
+
- Monitor GraphQL query costs via response headers
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
**IF you see rate limit errors:**
|
|
315
|
+
→ Implement exponential backoff retry logic
|
|
316
|
+
→ Switch to bulk operations for large datasets
|
|
317
|
+
→ Monitor `X-Shopify-Shop-Api-Call-Limit` header
|
|
318
|
+
|
|
319
|
+
**IF authentication fails:**
|
|
320
|
+
→ Verify the access token is still valid
|
|
321
|
+
→ Check that all required scopes were granted
|
|
322
|
+
→ Ensure OAuth flow completed successfully
|
|
323
|
+
|
|
324
|
+
**IF extension is not appearing:**
|
|
325
|
+
→ Verify the extension target is correct
|
|
326
|
+
→ Check that extension is published via `shopify app deploy`
|
|
327
|
+
→ Confirm the app is installed on the test store
|
|
328
|
+
|
|
329
|
+
**IF webhook is not receiving events:**
|
|
330
|
+
→ Verify the webhook URL is publicly accessible
|
|
331
|
+
→ Check HMAC signature validation logic
|
|
332
|
+
→ Review webhook logs in Partner Dashboard
|
|
333
|
+
|
|
334
|
+
**IF GraphQL query fails:**
|
|
335
|
+
→ Validate query against schema (use GraphiQL explorer)
|
|
336
|
+
→ Check for deprecated fields in error message
|
|
337
|
+
→ Verify you have required access scopes
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Reference Files
|
|
342
|
+
|
|
343
|
+
For detailed implementation guides, read these files:
|
|
344
|
+
|
|
345
|
+
- `references/app-development.md` - OAuth authentication flow, GraphQL mutations for products/orders/billing, webhook handlers, billing API integration
|
|
346
|
+
- `references/extensions.md` - Checkout UI components, Admin UI extensions, POS extensions, Shopify Functions for discounts/payment/delivery
|
|
347
|
+
- `references/themes.md` - Liquid syntax reference, theme directory structure, sections and snippets, common patterns
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Scripts
|
|
352
|
+
|
|
353
|
+
- `scripts/shopify_init.py` - Interactive project scaffolding. Run: `python scripts/shopify_init.py`
|
|
354
|
+
- `scripts/shopify_graphql.py` - GraphQL utilities with query templates, pagination, rate limiting. Import: `from shopify_graphql import ShopifyGraphQL`
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Official Documentation Links
|
|
359
|
+
|
|
360
|
+
- Shopify Developer Docs: https://shopify.dev/docs
|
|
361
|
+
- GraphQL Admin API Reference: https://shopify.dev/docs/api/admin-graphql
|
|
362
|
+
- Shopify CLI Reference: https://shopify.dev/docs/api/shopify-cli
|
|
363
|
+
- Polaris Design System: https://polaris.shopify.com
|
|
364
|
+
|
|
365
|
+
API Version: 2026-01 (quarterly releases, 12-month deprecation window)
|
|
366
|
+
|
|
367
|
+
## When to Use
|
|
368
|
+
This skill is applicable to execute the workflow or actions described in the overview.
|