Skip to content
Operations
Skill

/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.

From plugin
shopify-admin-skills
205116 skills

Claude Code

$ npx -y skills add 40rty-ai/shopify-admin-skills --skill shopify-admin-abandoned-cart-recovery --agent claude-code

SKILL.md

shopify-admin-abandoned-cart-recovery.SKILL.md
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_c
Read more
@40rty-ai
Ships withshopify-admin-skills

Community-maintained AI agent skills for operating Shopify stores — workflows, optimization, reports and more

Stars on GitHub

Momentum

stars in total
205
Star history of 40rty-ai/shopify-admin-skills on GitHub, a chart by star-history.com

Other skills on shopify-admin-skills.

More skills from other plugins.

diagnose-crash

diagnose-crash

Diagnose why a program crashed on this machine, from a systemd-coredump core dump. Use when a process has segfaulted, aborted, or…

omarchy8d47k
@basecamp@basecampInstall Skill
firewall-auditor

firewall-auditor

Audit UniFi firewall policies for conflicts, redundancies, security gaps, and best practices. Use when asked to review firewall…

unifi-mcp5d1.1k
@sirkirby@sirkirbyInstall Skill
add-custom-domain

add-custom-domain

Add a custom domain to a Temps project and provision an automatic SSL/TLS certificate via Let's Encrypt, driven entirely from the…

temps4d934
@gotempsh@gotempshInstall Skill

Questions about shopify-admin-abandoned-cart-recovery.

Which coding agents can use shopify-admin-abandoned-cart-recovery?
shopify-admin-abandoned-cart-recovery installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.