@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,431 @@
|
|
|
1
|
+
# Shopify Discounts
|
|
2
|
+
|
|
3
|
+
Manage discount codes, automatic discounts, Buy X Get Y promotions, and free shipping offers via the GraphQL Admin API.
|
|
4
|
+
|
|
5
|
+
## Discount Types
|
|
6
|
+
|
|
7
|
+
| Type | Description | Code Required |
|
|
8
|
+
|------|-------------|---------------|
|
|
9
|
+
| **Basic** | Percentage or fixed amount off | Optional (code or automatic) |
|
|
10
|
+
| **BXGY** | Buy X Get Y promotions | Optional (code or automatic) |
|
|
11
|
+
| **Free Shipping** | Waive shipping costs | Optional (code or automatic) |
|
|
12
|
+
| **App** | Custom logic via Shopify Functions | Optional (code or automatic) |
|
|
13
|
+
|
|
14
|
+
## List Discounts
|
|
15
|
+
|
|
16
|
+
```graphql
|
|
17
|
+
query ListDiscounts($first: Int!, $after: String, $query: String) {
|
|
18
|
+
discountNodes(first: $first, after: $after, query: $query) {
|
|
19
|
+
pageInfo {
|
|
20
|
+
hasNextPage
|
|
21
|
+
endCursor
|
|
22
|
+
}
|
|
23
|
+
nodes {
|
|
24
|
+
id
|
|
25
|
+
discount {
|
|
26
|
+
... on DiscountCodeBasic {
|
|
27
|
+
title
|
|
28
|
+
status
|
|
29
|
+
startsAt
|
|
30
|
+
endsAt
|
|
31
|
+
}
|
|
32
|
+
... on DiscountAutomaticBasic {
|
|
33
|
+
title
|
|
34
|
+
status
|
|
35
|
+
startsAt
|
|
36
|
+
endsAt
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
Variables: `{ "first": 10 }`
|
|
44
|
+
|
|
45
|
+
## Get Discount by ID
|
|
46
|
+
|
|
47
|
+
```graphql
|
|
48
|
+
query GetDiscount($id: ID!) {
|
|
49
|
+
discountNode(id: $id) {
|
|
50
|
+
id
|
|
51
|
+
discount {
|
|
52
|
+
... on DiscountCodeBasic {
|
|
53
|
+
title
|
|
54
|
+
status
|
|
55
|
+
startsAt
|
|
56
|
+
endsAt
|
|
57
|
+
usageLimit
|
|
58
|
+
appliesOncePerCustomer
|
|
59
|
+
combinesWith {
|
|
60
|
+
orderDiscounts
|
|
61
|
+
productDiscounts
|
|
62
|
+
shippingDiscounts
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
Variables: `{ "id": "gid://shopify/DiscountCodeNode/123" }`
|
|
70
|
+
|
|
71
|
+
## Create Code Discount (Percentage Off)
|
|
72
|
+
|
|
73
|
+
```graphql
|
|
74
|
+
mutation CreateBasicCodeDiscount($basicCodeDiscount: DiscountCodeBasicInput!) {
|
|
75
|
+
discountCodeBasicCreate(basicCodeDiscount: $basicCodeDiscount) {
|
|
76
|
+
codeDiscountNode {
|
|
77
|
+
id
|
|
78
|
+
codeDiscount {
|
|
79
|
+
... on DiscountCodeBasic {
|
|
80
|
+
title
|
|
81
|
+
codes(first: 1) {
|
|
82
|
+
nodes {
|
|
83
|
+
code
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
userErrors {
|
|
90
|
+
field
|
|
91
|
+
message
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
Variables:
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"basicCodeDiscount": {
|
|
100
|
+
"title": "20% Off Summer Sale",
|
|
101
|
+
"code": "SUMMER20",
|
|
102
|
+
"startsAt": "2025-06-01T00:00:00Z",
|
|
103
|
+
"endsAt": "2025-08-31T23:59:59Z",
|
|
104
|
+
"usageLimit": 1000,
|
|
105
|
+
"appliesOncePerCustomer": true,
|
|
106
|
+
"customerGets": {
|
|
107
|
+
"value": {
|
|
108
|
+
"percentage": 0.20
|
|
109
|
+
},
|
|
110
|
+
"items": {
|
|
111
|
+
"all": true
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"context": {
|
|
115
|
+
"allBuyers": true
|
|
116
|
+
},
|
|
117
|
+
"combinesWith": {
|
|
118
|
+
"shippingDiscounts": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Create Automatic Discount (Fixed Amount)
|
|
125
|
+
|
|
126
|
+
```graphql
|
|
127
|
+
mutation CreateAutomaticDiscount($automaticBasicDiscount: DiscountAutomaticBasicInput!) {
|
|
128
|
+
discountAutomaticBasicCreate(automaticBasicDiscount: $automaticBasicDiscount) {
|
|
129
|
+
automaticDiscountNode {
|
|
130
|
+
id
|
|
131
|
+
automaticDiscount {
|
|
132
|
+
... on DiscountAutomaticBasic {
|
|
133
|
+
title
|
|
134
|
+
status
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
userErrors {
|
|
139
|
+
field
|
|
140
|
+
message
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
Variables:
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"automaticBasicDiscount": {
|
|
149
|
+
"title": "$10 Off Orders Over $50",
|
|
150
|
+
"startsAt": "2025-01-01T00:00:00Z",
|
|
151
|
+
"minimumRequirement": {
|
|
152
|
+
"subtotal": {
|
|
153
|
+
"greaterThanOrEqualToSubtotal": "50.00"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"customerGets": {
|
|
157
|
+
"value": {
|
|
158
|
+
"discountAmount": {
|
|
159
|
+
"amount": "10.00",
|
|
160
|
+
"appliesOnEachItem": false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"items": {
|
|
164
|
+
"all": true
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"context": {
|
|
168
|
+
"allBuyers": true
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Create Buy X Get Y Discount
|
|
175
|
+
|
|
176
|
+
```graphql
|
|
177
|
+
mutation CreateBxgyDiscount($automaticBxgyDiscount: DiscountAutomaticBxgyInput!) {
|
|
178
|
+
discountAutomaticBxgyCreate(automaticBxgyDiscount: $automaticBxgyDiscount) {
|
|
179
|
+
automaticDiscountNode {
|
|
180
|
+
id
|
|
181
|
+
automaticDiscount {
|
|
182
|
+
... on DiscountAutomaticBxgy {
|
|
183
|
+
title
|
|
184
|
+
startsAt
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
userErrors {
|
|
189
|
+
field
|
|
190
|
+
message
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
Variables:
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"automaticBxgyDiscount": {
|
|
199
|
+
"title": "Buy 2 Get 1 Free",
|
|
200
|
+
"startsAt": "2025-01-01T00:00:00Z",
|
|
201
|
+
"customerBuys": {
|
|
202
|
+
"items": {
|
|
203
|
+
"collections": {
|
|
204
|
+
"add": ["gid://shopify/Collection/123"]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"value": {
|
|
208
|
+
"quantity": "2"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"customerGets": {
|
|
212
|
+
"items": {
|
|
213
|
+
"collections": {
|
|
214
|
+
"add": ["gid://shopify/Collection/123"]
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"value": {
|
|
218
|
+
"discountOnQuantity": {
|
|
219
|
+
"quantity": "1",
|
|
220
|
+
"effect": {
|
|
221
|
+
"percentage": 1.0
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"usesPerOrderLimit": "1",
|
|
227
|
+
"context": {
|
|
228
|
+
"allBuyers": true
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Create Free Shipping Discount
|
|
235
|
+
|
|
236
|
+
```graphql
|
|
237
|
+
mutation CreateFreeShippingDiscount($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!) {
|
|
238
|
+
discountCodeFreeShippingCreate(freeShippingCodeDiscount: $freeShippingCodeDiscount) {
|
|
239
|
+
codeDiscountNode {
|
|
240
|
+
id
|
|
241
|
+
codeDiscount {
|
|
242
|
+
... on DiscountCodeFreeShipping {
|
|
243
|
+
title
|
|
244
|
+
codes(first: 1) {
|
|
245
|
+
nodes {
|
|
246
|
+
code
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
userErrors {
|
|
253
|
+
field
|
|
254
|
+
message
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
Variables:
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"freeShippingCodeDiscount": {
|
|
263
|
+
"title": "Free Shipping Over $75",
|
|
264
|
+
"code": "FREESHIP75",
|
|
265
|
+
"startsAt": "2025-01-01T00:00:00Z",
|
|
266
|
+
"minimumRequirement": {
|
|
267
|
+
"subtotal": {
|
|
268
|
+
"greaterThanOrEqualToSubtotal": "75.00"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"context": {
|
|
272
|
+
"allBuyers": true
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Update Discount
|
|
279
|
+
|
|
280
|
+
```graphql
|
|
281
|
+
mutation UpdateCodeDiscount($id: ID!, $basicCodeDiscount: DiscountCodeBasicInput!) {
|
|
282
|
+
discountCodeBasicUpdate(id: $id, basicCodeDiscount: $basicCodeDiscount) {
|
|
283
|
+
codeDiscountNode {
|
|
284
|
+
id
|
|
285
|
+
}
|
|
286
|
+
userErrors {
|
|
287
|
+
field
|
|
288
|
+
message
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
Variables:
|
|
294
|
+
```json
|
|
295
|
+
{
|
|
296
|
+
"id": "gid://shopify/DiscountCodeNode/123",
|
|
297
|
+
"basicCodeDiscount": {
|
|
298
|
+
"endsAt": "2025-12-31T23:59:59Z"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Activate/Deactivate Discount
|
|
304
|
+
|
|
305
|
+
> REQUIRES PERMISSION: Activating or deactivating a discount changes its status immediately and affects pricing for all customers. Always ask the user for explicit confirmation before executing this operation.
|
|
306
|
+
|
|
307
|
+
```graphql
|
|
308
|
+
mutation ActivateCodeDiscount($id: ID!) {
|
|
309
|
+
discountCodeActivate(id: $id) {
|
|
310
|
+
codeDiscountNode {
|
|
311
|
+
id
|
|
312
|
+
codeDiscount {
|
|
313
|
+
... on DiscountCodeBasic {
|
|
314
|
+
status
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
userErrors {
|
|
319
|
+
field
|
|
320
|
+
message
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
```graphql
|
|
327
|
+
mutation DeactivateCodeDiscount($id: ID!) {
|
|
328
|
+
discountCodeDeactivate(id: $id) {
|
|
329
|
+
codeDiscountNode {
|
|
330
|
+
id
|
|
331
|
+
}
|
|
332
|
+
userErrors {
|
|
333
|
+
field
|
|
334
|
+
message
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Delete Discount
|
|
341
|
+
|
|
342
|
+
> REQUIRES PERMISSION: Deleting a discount is permanent and cannot be undone. Customers will no longer be able to use this discount code. Always ask the user for explicit confirmation before executing this operation.
|
|
343
|
+
|
|
344
|
+
```graphql
|
|
345
|
+
mutation DeleteCodeDiscount($id: ID!) {
|
|
346
|
+
discountCodeDelete(id: $id) {
|
|
347
|
+
deletedCodeDiscountId
|
|
348
|
+
userErrors {
|
|
349
|
+
field
|
|
350
|
+
message
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Bulk Delete Discounts
|
|
357
|
+
|
|
358
|
+
> REQUIRES PERMISSION: Bulk deletion permanently removes multiple discounts at once and cannot be undone. Always ask the user for explicit confirmation and show the list of discounts to be deleted before executing this operation.
|
|
359
|
+
|
|
360
|
+
```graphql
|
|
361
|
+
mutation BulkDeleteDiscounts($ids: [ID!]) {
|
|
362
|
+
discountCodeBulkDelete(ids: $ids) {
|
|
363
|
+
job {
|
|
364
|
+
id
|
|
365
|
+
done
|
|
366
|
+
}
|
|
367
|
+
userErrors {
|
|
368
|
+
field
|
|
369
|
+
message
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
Variables: `{ "ids": ["gid://shopify/DiscountCodeNode/123", "gid://shopify/DiscountCodeNode/456"] }`
|
|
375
|
+
|
|
376
|
+
## Target Customer Segments
|
|
377
|
+
|
|
378
|
+
To target specific customer segments with discounts, use the `context` field:
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"context": {
|
|
383
|
+
"customerSegments": {
|
|
384
|
+
"add": ["gid://shopify/Segment/123"]
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## API Scopes Required
|
|
391
|
+
|
|
392
|
+
- `read_discounts` - Read discount information
|
|
393
|
+
- `write_discounts` - Create, update, delete discounts
|
|
394
|
+
|
|
395
|
+
## Status Values
|
|
396
|
+
|
|
397
|
+
| Status | Description |
|
|
398
|
+
|--------|-------------|
|
|
399
|
+
| `ACTIVE` | Discount is currently active |
|
|
400
|
+
| `EXPIRED` | Discount has passed its end date |
|
|
401
|
+
| `SCHEDULED` | Discount has a future start date |
|
|
402
|
+
|
|
403
|
+
## Discount Combinations
|
|
404
|
+
|
|
405
|
+
Control which discount types can combine using `combinesWith`:
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"combinesWith": {
|
|
410
|
+
"orderDiscounts": true,
|
|
411
|
+
"productDiscounts": false,
|
|
412
|
+
"shippingDiscounts": true
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Dangerous Operations in This Skill
|
|
418
|
+
|
|
419
|
+
The following operations require explicit user permission before execution:
|
|
420
|
+
|
|
421
|
+
| Operation | Impact | Reversible |
|
|
422
|
+
|-----------|--------|------------|
|
|
423
|
+
| `discountCodeActivate` | Makes discount active and available to customers immediately | Yes (can deactivate) |
|
|
424
|
+
| `discountCodeDeactivate` | Makes discount inactive and unavailable to customers immediately | Yes (can reactivate) |
|
|
425
|
+
| `discountAutomaticActivate` | Makes automatic discount active immediately | Yes (can deactivate) |
|
|
426
|
+
| `discountAutomaticDeactivate` | Makes automatic discount inactive immediately | Yes (can reactivate) |
|
|
427
|
+
| `discountCodeDelete` | Permanently deletes discount code | No |
|
|
428
|
+
| `discountCodeBulkDelete` | Permanently deletes multiple discount codes at once | No |
|
|
429
|
+
| `discountAutomaticDelete` | Permanently deletes automatic discount | No |
|
|
430
|
+
|
|
431
|
+
Permission Protocol: Before executing any of these operations, describe what will be changed (discount ID, title, current status) and wait for explicit user confirmation.
|