Skip to content
Operations
Skill

/shopify-admin-discount-roi-calculator

Read-only: calculates the true ROI of each discount code and automatic discount by comparing incremental revenue against discount cost.

From plugin
shopify-admin-skills
205116 skills

Claude Code

$ npx -y skills add 40rty-ai/shopify-admin-skills --skill shopify-admin-discount-roi-calculator --agent claude-code

SKILL.md

shopify-admin-discount-roi-calculator.SKILL.md
name: shopify-admin-discount-roi-calculator
role: conversion-optimization
description: "Read-only: calculates the true ROI of each discount code and automatic discount by comparing incremental revenue against discount cost."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
  - discountNodes:query
  - orders:query
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLI

Purpose

Evaluates the true return on investment for each discount code and automatic discount by measuring revenue generated, number of orders, average order value with vs. without discount, customer acquisition attributed to discounts, and whether discounted orders cannibalized full-price sales. Goes beyond `discount-hygiene-cleanup` (which finds broken/unused codes) to answer "was this discount worth it?" Read-only — no mutations.

Prerequisites

  • Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders,read_discounts`
  • API scopes: `read_orders`, `read_discounts`

Parameters

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | store | string | yes | — | Store domain | | days_back | integer | no | 90 | Lookback window | | min_uses | integer | no | 3 | Minimum uses for a discount to be analyzed | | format | string | no | human | Output format: `human` or `json` |

Safety

> ℹ️ Read-only skill — no mutations are executed. Safe to run at any time.

Workflow Steps

1. **OPERATION:** `discountNodes` — query **Inputs:** `first: 250`, select discount details (title, code, type, value, usageCount, startsAt, endsAt), pagination cursor **Expected output:** All discount codes and automatic discounts

2. Filter to discounts with `usageCount >= min_uses` and active within lookback window

3. **OPERATION:** `orders` — query **Inputs:** `query: "created_at:>='<NOW - days_back days>' discount_code:<code>"`, `first: 250` for each active discount code, select `totalPriceSet`, `totalDiscountsSet`, `subtotalPriceSet`, `customer { id, numberOfOrders }`, pagination cursor **Expected output:** All orders using each discount

4. Also query orders WITHOUT any discount in same period for baseline AOV comparison

5. For each discount, calculate:

  • **Total Discount Cost** = Σ(totalDiscountsSet for orders with this code)
  • **Revenue Generated** = Σ(totalPriceSet for orders with this code)
  • **Discounted AOV** = revenue / orders
  • **Baseline AOV** = AOV of non-discounted orders in same period
  • **AOV Lift/Drop** = discounted AOV - baseline AOV
  • **New Customer %** = orders where customer.numberOfOrders == 1 / total
  • **Gross ROI** = (revenue - discount_cost) / discount_cost × 100
  • **Cannibalization Risk** = high if discount AOV < baseline AOV and new customer % < 20%

GraphQL Operations

# discountNodes:query — validated against api_version 2025-01
query AllDiscounts($after: String) {
  discountNodes(first: 250, after: $after) {
    edges {
      node {
        id
        discount {
          ... on DiscountCodeBasic {
            title
            codes(first: 1) { edges { node { code } } }
            usageLimit
            asyncUsageCount
            startsAt
            endsAt
            customerGets {
              value {
                ... on DiscountPercentage { percentage }
                ... on DiscountAmount { amount { amount currencyCode } }
              }
            }
          }
          ... on DiscountCodeFreeShipping {
            title
            codes(first: 1) { edges { node { code } } }
            asyncUsageCount
            startsAt
            endsAt
          }
          ... on DiscountAutomaticBasic {
            title
            asyncUsageCount
            startsAt
            endsAt
            customerGets {
              value {
                ... on DiscountPercentage { percentage }
                ... on DiscountAmount { amount { amount currencyCode } }
              }
            }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
# orders:query — validated against api_version 2025-01
query OrdersByDiscount($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        name
        createdAt
        totalPriceSet { shopMoney { amount currencyCode } }
        totalDiscountsSet { shopMoney { amount currencyCode } }
        subtotalPriceSet { shopMoney { amount currencyCode } }
        customer {
          id
          numberOfOrders
        }
        discountCodes
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}

Session Tracking

**Claude MUST emit the following output at each stage. This is mandatory.**

**On start**, emit:

╔══════════════════════════════════════════════╗
║  SKILL: Discount ROI Calculator              ║
║  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>

**On completion**, emit:

For `format: human` (default):

══════════════════════════════════════════════
DISCOUNT ROI REPORT  (<days_back> days)
  Discounts analyzed:   <n>
  Total discount spend:  $<amount>
  Total attributed rev:  $<amount>
  ─────────────────────────────
  TOP PERFORMERS (by ROI):
    "<code>"  ROI: <n>%  Revenue: $<n>  Cost: $<n>  New customers: <pct>%

  UNDERPERFORMERS:
    "<code>"  ROI: <n>%  Revenue: $<n>  Cost: $<n>  ⚠️ Cannibalization risk

  BASELINE COMPARISON:
    Non-discount AOV: $<n>  |  Avg discount AOV: $<n>  |  Δ: $<n>

  Output: discount_roi_<date>.csv
══════════════════════════════════════════════

Output Format

CSV file `discount_roi_<YYYY-MM-DD>.csv` with columns: `discoun

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-discount-roi-calculator.

Which coding agents can use shopify-admin-discount-roi-calculator?
shopify-admin-discount-roi-calculator 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.