@clawpify/skills 1.0.1
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/LICENSE +21 -0
- package/README.md +73 -0
- package/clawpify/SKILL.md +134 -0
- package/clawpify/references/blogs.md +385 -0
- package/clawpify/references/bulk-operations.md +386 -0
- package/clawpify/references/collections.md +71 -0
- package/clawpify/references/customers.md +141 -0
- package/clawpify/references/discounts.md +431 -0
- package/clawpify/references/draft-orders.md +495 -0
- package/clawpify/references/files.md +355 -0
- package/clawpify/references/fulfillments.md +437 -0
- package/clawpify/references/gift-cards.md +453 -0
- package/clawpify/references/inventory.md +107 -0
- package/clawpify/references/locations.md +349 -0
- package/clawpify/references/marketing.md +352 -0
- package/clawpify/references/markets.md +346 -0
- package/clawpify/references/menus.md +313 -0
- package/clawpify/references/metafields.md +461 -0
- package/clawpify/references/orders.md +164 -0
- package/clawpify/references/pages.md +308 -0
- package/clawpify/references/products.md +277 -0
- package/clawpify/references/refunds.md +401 -0
- package/clawpify/references/segments.md +319 -0
- package/clawpify/references/shipping.md +406 -0
- package/clawpify/references/shop.md +307 -0
- package/clawpify/references/subscriptions.md +429 -0
- package/clawpify/references/translations.md +270 -0
- package/clawpify/references/webhooks.md +400 -0
- package/dist/agent.d.ts +18 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +100 -0
- package/dist/auth.d.ts +34 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +58 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/mcp-server.d.ts +3 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +236 -0
- package/dist/shopify.d.ts +29 -0
- package/dist/shopify.d.ts.map +1 -0
- package/dist/shopify.js +41 -0
- package/dist/skills.d.ts +8 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +36 -0
- package/package.json +100 -0
- package/src/agent.ts +133 -0
- package/src/auth.ts +109 -0
- package/src/index.ts +55 -0
- package/src/mcp-server.ts +190 -0
- package/src/shopify.ts +63 -0
- package/src/skills.ts +42 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
# Shopify Metafields & Metaobjects
|
|
2
|
+
|
|
3
|
+
Manage custom data with metafields and metaobjects via the GraphQL Admin API.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
- **Metafields**: Custom fields attached to existing resources (products, customers, orders, etc.)
|
|
8
|
+
- **Metaobjects**: Standalone custom data structures with their own definitions
|
|
9
|
+
|
|
10
|
+
## Metafields
|
|
11
|
+
|
|
12
|
+
### Set Metafields
|
|
13
|
+
|
|
14
|
+
```graphql
|
|
15
|
+
mutation SetMetafields($metafields: [MetafieldsSetInput!]!) {
|
|
16
|
+
metafieldsSet(metafields: $metafields) {
|
|
17
|
+
metafields {
|
|
18
|
+
id
|
|
19
|
+
namespace
|
|
20
|
+
key
|
|
21
|
+
value
|
|
22
|
+
type
|
|
23
|
+
}
|
|
24
|
+
userErrors {
|
|
25
|
+
field
|
|
26
|
+
message
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
Variables:
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"metafields": [
|
|
35
|
+
{
|
|
36
|
+
"ownerId": "gid://shopify/Product/123",
|
|
37
|
+
"namespace": "custom",
|
|
38
|
+
"key": "material",
|
|
39
|
+
"value": "100% Cotton",
|
|
40
|
+
"type": "single_line_text_field"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"ownerId": "gid://shopify/Product/123",
|
|
44
|
+
"namespace": "custom",
|
|
45
|
+
"key": "care_instructions",
|
|
46
|
+
"value": "Machine wash cold, tumble dry low",
|
|
47
|
+
"type": "multi_line_text_field"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Delete Metafields
|
|
54
|
+
|
|
55
|
+
```graphql
|
|
56
|
+
mutation DeleteMetafields($metafields: [MetafieldIdentifierInput!]!) {
|
|
57
|
+
metafieldsDelete(metafields: $metafields) {
|
|
58
|
+
deletedMetafields {
|
|
59
|
+
ownerId
|
|
60
|
+
namespace
|
|
61
|
+
key
|
|
62
|
+
}
|
|
63
|
+
userErrors {
|
|
64
|
+
field
|
|
65
|
+
message
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
Variables:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"metafields": [
|
|
74
|
+
{
|
|
75
|
+
"ownerId": "gid://shopify/Product/123",
|
|
76
|
+
"namespace": "custom",
|
|
77
|
+
"key": "material"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Metafield Definitions
|
|
84
|
+
|
|
85
|
+
### List Definitions
|
|
86
|
+
|
|
87
|
+
```graphql
|
|
88
|
+
query ListMetafieldDefinitions($ownerType: MetafieldOwnerType!, $first: Int!) {
|
|
89
|
+
metafieldDefinitions(ownerType: $ownerType, first: $first) {
|
|
90
|
+
nodes {
|
|
91
|
+
id
|
|
92
|
+
name
|
|
93
|
+
namespace
|
|
94
|
+
key
|
|
95
|
+
type {
|
|
96
|
+
name
|
|
97
|
+
}
|
|
98
|
+
description
|
|
99
|
+
pinnedPosition
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
Variables: `{ "ownerType": "PRODUCT", "first": 20 }`
|
|
105
|
+
|
|
106
|
+
### Create Definition
|
|
107
|
+
|
|
108
|
+
```graphql
|
|
109
|
+
mutation CreateMetafieldDefinition($definition: MetafieldDefinitionInput!) {
|
|
110
|
+
metafieldDefinitionCreate(definition: $definition) {
|
|
111
|
+
createdDefinition {
|
|
112
|
+
id
|
|
113
|
+
name
|
|
114
|
+
namespace
|
|
115
|
+
key
|
|
116
|
+
}
|
|
117
|
+
userErrors {
|
|
118
|
+
field
|
|
119
|
+
message
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
Variables:
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"definition": {
|
|
128
|
+
"name": "Material",
|
|
129
|
+
"namespace": "custom",
|
|
130
|
+
"key": "material",
|
|
131
|
+
"type": "single_line_text_field",
|
|
132
|
+
"ownerType": "PRODUCT",
|
|
133
|
+
"description": "Product material composition",
|
|
134
|
+
"pin": true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Update Definition
|
|
140
|
+
|
|
141
|
+
```graphql
|
|
142
|
+
mutation UpdateMetafieldDefinition($definition: MetafieldDefinitionUpdateInput!) {
|
|
143
|
+
metafieldDefinitionUpdate(definition: $definition) {
|
|
144
|
+
updatedDefinition {
|
|
145
|
+
id
|
|
146
|
+
name
|
|
147
|
+
}
|
|
148
|
+
userErrors {
|
|
149
|
+
field
|
|
150
|
+
message
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Delete Definition
|
|
157
|
+
|
|
158
|
+
```graphql
|
|
159
|
+
mutation DeleteMetafieldDefinition($id: ID!, $deleteAllAssociatedMetafields: Boolean!) {
|
|
160
|
+
metafieldDefinitionDelete(id: $id, deleteAllAssociatedMetafields: $deleteAllAssociatedMetafields) {
|
|
161
|
+
deletedDefinitionId
|
|
162
|
+
userErrors {
|
|
163
|
+
field
|
|
164
|
+
message
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Metafield Types
|
|
171
|
+
|
|
172
|
+
| Type | Example Value |
|
|
173
|
+
|------|---------------|
|
|
174
|
+
| `single_line_text_field` | `"Hello"` |
|
|
175
|
+
| `multi_line_text_field` | `"Line 1\nLine 2"` |
|
|
176
|
+
| `number_integer` | `"42"` |
|
|
177
|
+
| `number_decimal` | `"19.99"` |
|
|
178
|
+
| `boolean` | `"true"` |
|
|
179
|
+
| `date` | `"2025-01-15"` |
|
|
180
|
+
| `date_time` | `"2025-01-15T10:00:00Z"` |
|
|
181
|
+
| `json` | `"{\"key\": \"value\"}"` |
|
|
182
|
+
| `color` | `"#FF5733"` |
|
|
183
|
+
| `weight` | `"{\"value\": 1.5, \"unit\": \"kg\"}"` |
|
|
184
|
+
| `dimension` | `"{\"value\": 10, \"unit\": \"cm\"}"` |
|
|
185
|
+
| `volume` | `"{\"value\": 500, \"unit\": \"ml\"}"` |
|
|
186
|
+
| `url` | `"https://example.com"` |
|
|
187
|
+
| `money` | `"{\"amount\": \"29.99\", \"currency_code\": \"USD\"}"` |
|
|
188
|
+
| `rating` | `"{\"value\": \"4.5\", \"scale_min\": \"1\", \"scale_max\": \"5\"}"` |
|
|
189
|
+
| `rich_text_field` | `"{\"type\":\"root\",\"children\":[...]}"` |
|
|
190
|
+
| `file_reference` | `"gid://shopify/MediaImage/123"` |
|
|
191
|
+
| `product_reference` | `"gid://shopify/Product/123"` |
|
|
192
|
+
| `collection_reference` | `"gid://shopify/Collection/123"` |
|
|
193
|
+
| `page_reference` | `"gid://shopify/Page/123"` |
|
|
194
|
+
| `metaobject_reference` | `"gid://shopify/Metaobject/123"` |
|
|
195
|
+
| `list.single_line_text_field` | `"[\"Item 1\", \"Item 2\"]"` |
|
|
196
|
+
|
|
197
|
+
## Metafield Owner Types
|
|
198
|
+
|
|
199
|
+
| Type | Description |
|
|
200
|
+
|------|-------------|
|
|
201
|
+
| `PRODUCT` | Products |
|
|
202
|
+
| `PRODUCTVARIANT` | Product variants |
|
|
203
|
+
| `COLLECTION` | Collections |
|
|
204
|
+
| `CUSTOMER` | Customers |
|
|
205
|
+
| `ORDER` | Orders |
|
|
206
|
+
| `SHOP` | Shop settings |
|
|
207
|
+
| `COMPANY` | B2B companies |
|
|
208
|
+
| `COMPANYLOCATION` | B2B company locations |
|
|
209
|
+
| `DRAFTORDER` | Draft orders |
|
|
210
|
+
| `ARTICLE` | Blog articles |
|
|
211
|
+
| `BLOG` | Blogs |
|
|
212
|
+
| `PAGE` | Pages |
|
|
213
|
+
| `LOCATION` | Locations |
|
|
214
|
+
|
|
215
|
+
## Metaobjects
|
|
216
|
+
|
|
217
|
+
### List Metaobject Definitions
|
|
218
|
+
|
|
219
|
+
```graphql
|
|
220
|
+
query ListMetaobjectDefinitions($first: Int!) {
|
|
221
|
+
metaobjectDefinitions(first: $first) {
|
|
222
|
+
nodes {
|
|
223
|
+
id
|
|
224
|
+
name
|
|
225
|
+
type
|
|
226
|
+
fieldDefinitions {
|
|
227
|
+
name
|
|
228
|
+
key
|
|
229
|
+
type {
|
|
230
|
+
name
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Create Metaobject Definition
|
|
239
|
+
|
|
240
|
+
```graphql
|
|
241
|
+
mutation CreateMetaobjectDefinition($definition: MetaobjectDefinitionCreateInput!) {
|
|
242
|
+
metaobjectDefinitionCreate(definition: $definition) {
|
|
243
|
+
metaobjectDefinition {
|
|
244
|
+
id
|
|
245
|
+
name
|
|
246
|
+
type
|
|
247
|
+
}
|
|
248
|
+
userErrors {
|
|
249
|
+
field
|
|
250
|
+
message
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
Variables:
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"definition": {
|
|
259
|
+
"name": "Store Location",
|
|
260
|
+
"type": "store_location",
|
|
261
|
+
"fieldDefinitions": [
|
|
262
|
+
{
|
|
263
|
+
"name": "Name",
|
|
264
|
+
"key": "name",
|
|
265
|
+
"type": "single_line_text_field",
|
|
266
|
+
"required": true
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "Address",
|
|
270
|
+
"key": "address",
|
|
271
|
+
"type": "multi_line_text_field"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"name": "Phone",
|
|
275
|
+
"key": "phone",
|
|
276
|
+
"type": "single_line_text_field"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "Image",
|
|
280
|
+
"key": "image",
|
|
281
|
+
"type": "file_reference"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"capabilities": {
|
|
285
|
+
"publishable": {
|
|
286
|
+
"enabled": true
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### List Metaobjects
|
|
294
|
+
|
|
295
|
+
```graphql
|
|
296
|
+
query ListMetaobjects($type: String!, $first: Int!) {
|
|
297
|
+
metaobjects(type: $type, first: $first) {
|
|
298
|
+
nodes {
|
|
299
|
+
id
|
|
300
|
+
handle
|
|
301
|
+
displayName
|
|
302
|
+
fields {
|
|
303
|
+
key
|
|
304
|
+
value
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
Variables: `{ "type": "store_location", "first": 10 }`
|
|
311
|
+
|
|
312
|
+
### Create Metaobject
|
|
313
|
+
|
|
314
|
+
```graphql
|
|
315
|
+
mutation CreateMetaobject($metaobject: MetaobjectCreateInput!) {
|
|
316
|
+
metaobjectCreate(metaobject: $metaobject) {
|
|
317
|
+
metaobject {
|
|
318
|
+
id
|
|
319
|
+
handle
|
|
320
|
+
}
|
|
321
|
+
userErrors {
|
|
322
|
+
field
|
|
323
|
+
message
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
Variables:
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"metaobject": {
|
|
332
|
+
"type": "store_location",
|
|
333
|
+
"handle": "new-york-store",
|
|
334
|
+
"fields": [
|
|
335
|
+
{
|
|
336
|
+
"key": "name",
|
|
337
|
+
"value": "New York Flagship Store"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"key": "address",
|
|
341
|
+
"value": "123 Broadway, New York, NY 10001"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"key": "phone",
|
|
345
|
+
"value": "+1 (212) 555-0100"
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Update Metaobject
|
|
353
|
+
|
|
354
|
+
```graphql
|
|
355
|
+
mutation UpdateMetaobject($id: ID!, $metaobject: MetaobjectUpdateInput!) {
|
|
356
|
+
metaobjectUpdate(id: $id, metaobject: $metaobject) {
|
|
357
|
+
metaobject {
|
|
358
|
+
id
|
|
359
|
+
fields {
|
|
360
|
+
key
|
|
361
|
+
value
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
userErrors {
|
|
365
|
+
field
|
|
366
|
+
message
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Upsert Metaobject
|
|
373
|
+
|
|
374
|
+
```graphql
|
|
375
|
+
mutation UpsertMetaobject($handle: MetaobjectHandleInput!, $metaobject: MetaobjectUpsertInput!) {
|
|
376
|
+
metaobjectUpsert(handle: $handle, metaobject: $metaobject) {
|
|
377
|
+
metaobject {
|
|
378
|
+
id
|
|
379
|
+
handle
|
|
380
|
+
}
|
|
381
|
+
userErrors {
|
|
382
|
+
field
|
|
383
|
+
message
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
Variables:
|
|
389
|
+
```json
|
|
390
|
+
{
|
|
391
|
+
"handle": {
|
|
392
|
+
"type": "store_location",
|
|
393
|
+
"handle": "new-york-store"
|
|
394
|
+
},
|
|
395
|
+
"metaobject": {
|
|
396
|
+
"fields": [
|
|
397
|
+
{
|
|
398
|
+
"key": "phone",
|
|
399
|
+
"value": "+1 (212) 555-0200"
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Delete Metaobject
|
|
407
|
+
|
|
408
|
+
```graphql
|
|
409
|
+
mutation DeleteMetaobject($id: ID!) {
|
|
410
|
+
metaobjectDelete(id: $id) {
|
|
411
|
+
deletedId
|
|
412
|
+
userErrors {
|
|
413
|
+
field
|
|
414
|
+
message
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Bulk Delete Metaobjects
|
|
421
|
+
|
|
422
|
+
```graphql
|
|
423
|
+
mutation BulkDeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {
|
|
424
|
+
metaobjectBulkDelete(where: $where) {
|
|
425
|
+
job {
|
|
426
|
+
id
|
|
427
|
+
done
|
|
428
|
+
}
|
|
429
|
+
userErrors {
|
|
430
|
+
field
|
|
431
|
+
message
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
Variables:
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"where": {
|
|
440
|
+
"type": "store_location",
|
|
441
|
+
"ids": ["gid://shopify/Metaobject/1", "gid://shopify/Metaobject/2"]
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## API Scopes Required
|
|
447
|
+
|
|
448
|
+
- `read_metafields` - Read metafields
|
|
449
|
+
- `write_metafields` - Create, update, delete metafields
|
|
450
|
+
- `read_metaobject_definitions` - Read metaobject definitions
|
|
451
|
+
- `write_metaobject_definitions` - Manage metaobject definitions
|
|
452
|
+
- `read_metaobjects` - Read metaobjects
|
|
453
|
+
- `write_metaobjects` - Create, update, delete metaobjects
|
|
454
|
+
|
|
455
|
+
## Notes
|
|
456
|
+
|
|
457
|
+
- Namespace `$app:` is reserved for app-specific metafields
|
|
458
|
+
- Metafield values are always strings (even for numbers/booleans)
|
|
459
|
+
- Use definitions for validation and admin UI integration
|
|
460
|
+
- Metaobjects are useful for structured content like FAQs, team members, store locations
|
|
461
|
+
- Maximum 25 metafields per `metafieldsSet` call
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Shopify Orders
|
|
2
|
+
|
|
3
|
+
## List Orders
|
|
4
|
+
|
|
5
|
+
```graphql
|
|
6
|
+
query ListOrders($first: Int!, $after: String, $query: String) {
|
|
7
|
+
orders(first: $first, after: $after, query: $query) {
|
|
8
|
+
pageInfo {
|
|
9
|
+
hasNextPage
|
|
10
|
+
endCursor
|
|
11
|
+
}
|
|
12
|
+
nodes {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
createdAt
|
|
16
|
+
displayFinancialStatus
|
|
17
|
+
displayFulfillmentStatus
|
|
18
|
+
totalPriceSet {
|
|
19
|
+
shopMoney {
|
|
20
|
+
amount
|
|
21
|
+
currencyCode
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
customer {
|
|
25
|
+
id
|
|
26
|
+
displayName
|
|
27
|
+
defaultEmailAddress {
|
|
28
|
+
emailAddress
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
Variables: `{ "first": 10 }`
|
|
36
|
+
|
|
37
|
+
Order query syntax:
|
|
38
|
+
- `financial_status:paid` - PENDING, AUTHORIZED, PARTIALLY_PAID, PAID, PARTIALLY_REFUNDED, REFUNDED, VOIDED
|
|
39
|
+
- `fulfillment_status:unfulfilled` - UNFULFILLED, PARTIALLY_FULFILLED, FULFILLED
|
|
40
|
+
- `created_at:>2024-01-01` - date filters
|
|
41
|
+
- `name:#1001` - by order number
|
|
42
|
+
|
|
43
|
+
## Get Order by ID
|
|
44
|
+
|
|
45
|
+
```graphql
|
|
46
|
+
query GetOrder($id: ID!) {
|
|
47
|
+
order(id: $id) {
|
|
48
|
+
id
|
|
49
|
+
name
|
|
50
|
+
email
|
|
51
|
+
createdAt
|
|
52
|
+
displayFinancialStatus
|
|
53
|
+
displayFulfillmentStatus
|
|
54
|
+
totalPriceSet {
|
|
55
|
+
shopMoney {
|
|
56
|
+
amount
|
|
57
|
+
currencyCode
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
subtotalPriceSet {
|
|
61
|
+
shopMoney {
|
|
62
|
+
amount
|
|
63
|
+
currencyCode
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
totalShippingPriceSet {
|
|
67
|
+
shopMoney {
|
|
68
|
+
amount
|
|
69
|
+
currencyCode
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
totalTaxSet {
|
|
73
|
+
shopMoney {
|
|
74
|
+
amount
|
|
75
|
+
currencyCode
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
lineItems(first: 50) {
|
|
79
|
+
nodes {
|
|
80
|
+
id
|
|
81
|
+
title
|
|
82
|
+
quantity
|
|
83
|
+
sku
|
|
84
|
+
originalUnitPriceSet {
|
|
85
|
+
shopMoney {
|
|
86
|
+
amount
|
|
87
|
+
currencyCode
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
variant {
|
|
91
|
+
id
|
|
92
|
+
title
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
shippingAddress {
|
|
97
|
+
address1
|
|
98
|
+
address2
|
|
99
|
+
city
|
|
100
|
+
province
|
|
101
|
+
country
|
|
102
|
+
zip
|
|
103
|
+
phone
|
|
104
|
+
}
|
|
105
|
+
customer {
|
|
106
|
+
id
|
|
107
|
+
displayName
|
|
108
|
+
email
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
Variables: `{ "id": "gid://shopify/Order/123" }`
|
|
114
|
+
|
|
115
|
+
## Cancel Order
|
|
116
|
+
|
|
117
|
+
> REQUIRES PERMISSION: Cancelling an order may trigger automatic refunds to the customer and affects inventory if restocking is enabled. This is a significant business operation. Always ask the user for explicit confirmation, show the order details and refund method, and wait for approval before executing this operation.
|
|
118
|
+
|
|
119
|
+
```graphql
|
|
120
|
+
mutation CancelOrder($orderId: ID!, $reason: OrderCancelReason!, $restock: Boolean!, $refundMethod: OrderCancelRefundMethodInput) {
|
|
121
|
+
orderCancel(orderId: $orderId, reason: $reason, restock: $restock, refundMethod: $refundMethod) {
|
|
122
|
+
job {
|
|
123
|
+
id
|
|
124
|
+
}
|
|
125
|
+
orderCancelUserErrors {
|
|
126
|
+
field
|
|
127
|
+
message
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
Variables:
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"orderId": "gid://shopify/Order/123",
|
|
136
|
+
"reason": "CUSTOMER",
|
|
137
|
+
"restock": true,
|
|
138
|
+
"refundMethod": {
|
|
139
|
+
"originalPaymentMethodsRefund": true
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
Reasons: CUSTOMER, FRAUD, INVENTORY, DECLINED, OTHER
|
|
144
|
+
|
|
145
|
+
Refund options:
|
|
146
|
+
- `originalPaymentMethodsRefund: true` - refund to original payment method
|
|
147
|
+
- `storeCreditRefund: { fullAmount: true }` - refund as store credit
|
|
148
|
+
|
|
149
|
+
## Dangerous Operations in This Skill
|
|
150
|
+
|
|
151
|
+
The following operations require explicit user permission before execution:
|
|
152
|
+
|
|
153
|
+
| Operation | Impact | Reversible |
|
|
154
|
+
|-----------|--------|------------|
|
|
155
|
+
| `orderCancel` | Cancels order and may trigger automatic refunds to customer | Partial - Order status change is permanent, but new order can be created |
|
|
156
|
+
|
|
157
|
+
Permission Protocol: Before executing `orderCancel`:
|
|
158
|
+
1. Show the order ID, order number, and customer information
|
|
159
|
+
2. Display the order total and line items
|
|
160
|
+
3. Indicate whether inventory will be restocked
|
|
161
|
+
4. Show the refund method (original payment vs store credit)
|
|
162
|
+
5. Explain the cancellation reason being used
|
|
163
|
+
6. Wait for explicit user confirmation with "yes", "confirm", or "proceed"
|
|
164
|
+
7. Warn that refunds cannot be reversed once processed
|