/shopify-admin-abandoned-cart-recovery
Query checkouts abandoned in the last N days, generate unique discount codes per customer, and tag them for re-engagement.
$ npx -y skills add 40rty-ai/shopify-admin-skills --skill shopify-admin-abandoned-cart-recovery --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/shopify-admin-abandoned-cart-recovery
Context preview
The summary Claude sees to decide when to auto-load this skill.
Query checkouts abandoned in the last N days, generate unique discount codes per customer, and tag them for re-engagement.
SKILL.md
shopify-admin-abandoned-cart-recovery.SKILL.mdname: shopify-admin-abandoned-cart-recovery
role: marketing
description: "Query checkouts abandoned in the last N days, generate unique discount codes per customer, and tag them for re-engagement."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
- abandonedCheckouts:query
- discountCodeBulkCreate:mutation
- tagsAdd:mutation
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLI
Purpose
Identifies customers who started checkout but did not complete their purchase, generates a unique discount code for each one, and tags them in Shopify so they can be targeted in follow-up campaigns. This skill handles the Shopify-native data layer (querying, discounts, tagging); sending the actual email requires an external tool.
Prerequisites
- Authenticated Shopify CLI session: `shopify auth login --store <domain>`
- API scopes: `read_checkouts`, `write_price_rules`, `write_discount_codes`, `write_customers`
Parameters
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | store | string | yes | — | Store domain (e.g., mystore.myshopify.com) | | format | string | no | human | Output format: `human` or `json` | | dry_run | bool | no | false | Preview operations without executing mutations | | days_back | integer | no | 7 | Lookback window for abandoned checkouts | | min_cart_value | float | no | 0 | Minimum cart total to include (USD) | | discount_pct | integer | no | 10 | Discount percentage to create per customer | | code_prefix | string | no | RECOVER | Prefix for generated discount codes | | tag | string | no | cart-recovery | Tag applied to eligible customers |
Safety
> ⚠️ Steps 2 and 3 execute mutations (discount code creation, customer tagging). Discount codes created via `discountCodeBulkCreate` cannot be bulk-deleted via the Admin API — they must be removed individually or via the price rule. Run with `dry_run: true` to verify eligible customer count before committing.
Workflow Steps
1. **OPERATION:** `abandonedCheckouts` — query **Inputs:** `first: 250`, `query: "created_at:>='<NOW - days_back days>'"`, pagination cursor **Expected output:** List of checkout objects with `email`, `totalPrice`, `createdAt`, `lineItems`; paginate until `hasNextPage: false`
2. **OPERATION:** `discountCodeBulkCreate` — mutation **Inputs:** For each eligible customer email: a unique code `{code_prefix}-{UUID[:8].toUpperCase()}`, percentage discount `discount_pct`, usage limit 1, expiry 30 days **Expected output:** Confirmation of code creation with `code` and `priceRule.id`; collect `userErrors`
3. **OPERATION:** `tagsAdd` — mutation **Inputs:** Customer `id` (from checkout `email` lookup), tag string from `tag` parameter **Expected output:** Updated customer tags; collect `userErrors`
GraphQL Operations
# abandonedCheckouts:query — validated against api_version 2025-04
query AbandonedCheckouts($first: Int!, $after: String, $query: String) {
abandonedCheckouts(first: $first, after: $after, query: $query) {
edges {
node {
id
customer {
defaultEmailAddress {
emailAddress
}
}
totalPriceSet {
shopMoney {
amount
currencyCode
}
}
createdAt
lineItems {
edges {
node {
title
quantity
variant {
price
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}# discountCodeBulkCreate:mutation — validated against api_version 2025-01
mutation DiscountCodeBulkCreate($priceRuleId: ID!, $codes: [DiscountCodeInput!]!) {
discountCodeBulkCreate(priceRuleId: $priceRuleId, codes: $codes) {
bulkCreations {
id
done
}
userErrors {
field
message
}
}
}# tagsAdd:mutation — validated against api_version 2025-01
mutation TagsAdd($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
field
message
}
}
}Session Tracking
**Claude MUST emit the following output at each stage. This is mandatory.**
**On start**, emit:
╔══════════════════════════════════════════════╗
║ SKILL: Abandoned Cart Recovery ║
║ Store: <store domain> ║
║ Started: <YYYY-MM-DD HH:MM UTC> ║
╚══════════════════════════════════════════════╝
**After each step**, emit:
[N/TOTAL] <QUERY|MUTATION> <OperationName>
→ Params: <brief summary of key inputs>
→ Result: <count or outcome>If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it.
**On completion**, emit:
For `format: human` (default):
══════════════════════════════════════════════
OUTCOME SUMMARY
Checkouts found: <n>
Eligible customers: <n>
Codes created: <n>
Customers tagged: <n>
Errors: <n>
Output: recovery_list_<date>.csv
══════════════════════════════════════════════
For `format: json`, emit:
{
"skill": "abandoned-cart-recovery",
"store": "<domain>",
"started_at": "<ISO8601>",
"completed_at": "<ISO8601>",
"dry_run": false,
"steps": [
{ "step": 1, "operation": "AbandonedCheckouts", "type": "query", "params_summary": "last 7 days, cart >= $0", "result_summary": "<n> checkouts", "skipped": false },
{ "step": 2, "operation": "DiscountCodeBulkCreate", "type": "mutation", "params_summary": "<n> codes, 10% off, prefix RECOVER", "result_summary": "<n> created", "skipped": false },
{ "step": 3, "operation": "TagsAdd", "type": "mutation", "params_summary": "tag: cart-recovery", "result_summary": "<n> customers tagged", "skipped": false }
],
"outcome": {
"checkouts_found": 0,
"eligible_cRead more
name: shopify-admin-abandoned-cart-recovery role: marketing description: "Query checkouts abandoned in the last N days, generate unique discount codes per customer, and tag them for re-engagement." toolkit: shopify-admin, shopify-admin-execution api_version: "2025-01" graphql_operations: - abandonedCheckouts:query - discountCodeBulkCreate:mutation - tagsAdd:mutation status: stable compatibility: Claude Code, Cursor, Codex, Gemini CLI
Purpose
Identifies customers who started checkout but did not complete their purchase, generates a unique discount code for each one, and tags them in Shopify so they can be targeted in follow-up campaigns. This skill handles the Shopify-native data layer (querying, discounts, tagging); sending the actual email requires an external tool.
Prerequisites
- Authenticated Shopify CLI session: `shopify auth login --store <domain>`
- API scopes: `read_checkouts`, `write_price_rules`, `write_discount_codes`, `write_customers`
Parameters
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | store | string | yes | — | Store domain (e.g., mystore.myshopify.com) | | format | string | no | human | Output format: `human` or `json` | | dry_run | bool | no | false | Preview operations without executing mutations | | days_back | integer | no | 7 | Lookback window for abandoned checkouts | | min_cart_value | float | no | 0 | Minimum cart total to include (USD) | | discount_pct | integer | no | 10 | Discount percentage to create per customer | | code_prefix | string | no | RECOVER | Prefix for generated discount codes | | tag | string | no | cart-recovery | Tag applied to eligible customers |
Safety
> ⚠️ Steps 2 and 3 execute mutations (discount code creation, customer tagging). Discount codes created via `discountCodeBulkCreate` cannot be bulk-deleted via the Admin API — they must be removed individually or via the price rule. Run with `dry_run: true` to verify eligible customer count before committing.
Workflow Steps
1. **OPERATION:** `abandonedCheckouts` — query **Inputs:** `first: 250`, `query: "created_at:>='<NOW - days_back days>'"`, pagination cursor **Expected output:** List of checkout objects with `email`, `totalPrice`, `createdAt`, `lineItems`; paginate until `hasNextPage: false`
2. **OPERATION:** `discountCodeBulkCreate` — mutation **Inputs:** For each eligible customer email: a unique code `{code_prefix}-{UUID[:8].toUpperCase()}`, percentage discount `discount_pct`, usage limit 1, expiry 30 days **Expected output:** Confirmation of code creation with `code` and `priceRule.id`; collect `userErrors`
3. **OPERATION:** `tagsAdd` — mutation **Inputs:** Customer `id` (from checkout `email` lookup), tag string from `tag` parameter **Expected output:** Updated customer tags; collect `userErrors`
GraphQL Operations
# abandonedCheckouts:query — validated against api_version 2025-04
query AbandonedCheckouts($first: Int!, $after: String, $query: String) {
abandonedCheckouts(first: $first, after: $after, query: $query) {
edges {
node {
id
customer {
defaultEmailAddress {
emailAddress
}
}
totalPriceSet {
shopMoney {
amount
currencyCode
}
}
createdAt
lineItems {
edges {
node {
title
quantity
variant {
price
}
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}# discountCodeBulkCreate:mutation — validated against api_version 2025-01
mutation DiscountCodeBulkCreate($priceRuleId: ID!, $codes: [DiscountCodeInput!]!) {
discountCodeBulkCreate(priceRuleId: $priceRuleId, codes: $codes) {
bulkCreations {
id
done
}
userErrors {
field
message
}
}
}# tagsAdd:mutation — validated against api_version 2025-01
mutation TagsAdd($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
field
message
}
}
}Session Tracking
**Claude MUST emit the following output at each stage. This is mandatory.**
**On start**, emit:
╔══════════════════════════════════════════════╗ ║ SKILL: Abandoned Cart Recovery ║ ║ Store: <store domain> ║ ║ Started: <YYYY-MM-DD HH:MM UTC> ║ ╚══════════════════════════════════════════════╝
**After each step**, emit:
[N/TOTAL] <QUERY|MUTATION> <OperationName>
→ Params: <brief summary of key inputs>
→ Result: <count or outcome>If `dry_run: true`, prefix every mutation step with `[DRY RUN]` and do not execute it.
**On completion**, emit:
For `format: human` (default):
══════════════════════════════════════════════ OUTCOME SUMMARY Checkouts found: <n> Eligible customers: <n> Codes created: <n> Customers tagged: <n> Errors: <n> Output: recovery_list_<date>.csv ══════════════════════════════════════════════
For `format: json`, emit:
{
"skill": "abandoned-cart-recovery",
"store": "<domain>",
"started_at": "<ISO8601>",
"completed_at": "<ISO8601>",
"dry_run": false,
"steps": [
{ "step": 1, "operation": "AbandonedCheckouts", "type": "query", "params_summary": "last 7 days, cart >= $0", "result_summary": "<n> checkouts", "skipped": false },
{ "step": 2, "operation": "DiscountCodeBulkCreate", "type": "mutation", "params_summary": "<n> codes, 10% off, prefix RECOVER", "result_summary": "<n> created", "skipped": false },
{ "step": 3, "operation": "TagsAdd", "type": "mutation", "params_summary": "tag: cart-recovery", "result_summary": "<n> customers tagged", "skipped": false }
],
"outcome": {
"checkouts_found": 0,
"eligible_cCommunity-maintained AI agent skills for operating Shopify stores — workflows, optimization, reports and more
Other skills on shopify-admin-skills.
- /shopify-admin-agentic-crawler-access
Edit the theme's robots.txt.liquid to explicitly allow AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, OAI-SearchBot, Amazonbot) so AI assistants are permitted to read the catalog.
Open skill - /shopify-admin-agentic-description-enrichment
Rewrite thin product descriptions into structured, fact-rich copy (materials, fit, use-cases, the words shoppers actually type) so AI agents have something concrete to quote and match.
Open skill - /shopify-admin-agentic-image-alt-text
Generate and set descriptive alt text on product images so AI agents (which can't 'see' pixels) can understand and recommend what each product looks like.
Open skill - /shopify-admin-agentic-llms-txt
Generate and publish an /llms.txt guide (brand summary, flagship products, key policies, contact) via a theme template so AI assistants get a curated, machine-readable map of the store.
Open skill - /shopify-admin-agentic-metafields-setup
Define and populate agentic-commerce metafields (material, attributes, key features, specs, sizing) so AI agents can filter and match products to specific shopper requirements.
Open skill - /shopify-admin-agentic-organization-schema
Inject an Organization JSON-LD block (name, logo, sameAs social links, contactPoint) into the theme so AI agents can verify the store is a real, trusted brand and link it to its public identity.
Open skill

