Install
$ agentstack add skill-40rty-ai-shopify-admin-skills-shopify-admin-discount-roi-calculator ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
About
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 --scopes read_orders,read_discounts - API scopes:
read_orders,read_discounts
Parameters
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | store | string | yes | — | Store domain | | daysback | integer | no | 90 | Lookback window | | minuses | 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
- 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
- Filter to discounts with
usageCount >= min_usesand active within lookback window
- OPERATION:
orders— query
Inputs: query: "created_at:>='' discount_code:", first: 250 for each active discount code, select totalPriceSet, totalDiscountsSet, subtotalPriceSet, customer { id, numberOfOrders }, pagination cursor Expected output: All orders using each discount
- Also query orders WITHOUT any discount in same period for baseline AOV comparison
- 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 - discountcost) / discountcost × 100
- Cannibalization Risk = high if discount AOV ║
║ Started: ║ ╚══════════════════════════════════════════════╝
**After each step**, emit:
[N/TOTAL] → Params: → Result:
**On completion**, emit:
For `format: human` (default):
══════════════════════════════════════════════ DISCOUNT ROI REPORT ( days) Discounts analyzed: Total discount spend: $ Total attributed rev: $ ───────────────────────────── TOP PERFORMERS (by ROI): "" ROI: % Revenue: $ Cost: $ New customers: %
UNDERPERFORMERS: "" ROI: % Revenue: $ Cost: $ ⚠️ Cannibalization risk
BASELINE COMPARISON: Non-discount AOV: $ | Avg discount AOV: $ | Δ: $
Output: discountroi.csv ══════════════════════════════════════════════
## Output Format
CSV file `discount_roi_.csv` with columns:
`discount_id`, `code_or_title`, `type`, `uses`, `revenue`, `discount_cost`, `roi_pct`, `aov`, `baseline_aov`, `aov_delta`, `new_customer_pct`, `cannibalization_risk`
## Error Handling
| Error | Cause | Recovery |
|-------|-------|----------|
| `THROTTLED` | API rate limit exceeded | Wait 2 seconds, retry up to 3 times |
| Automatic discounts | No code to query by | Match via order discount data |
| Stacked discounts | Multiple codes per order | Attribute proportionally or flag as "multi-discount" |
## Best Practices
- Discounts with ROI < 100% cost more than they generate — consider retiring them.
- High new-customer % with positive ROI = great acquisition tool — keep running.
- Low new-customer % with negative AOV lift = cannibalization — customers would have bought anyway.
- Cross-reference with `discount-ab-analysis` for split-test insights.
- Use with `discount-hygiene-cleanup` to find and remove underperforming codes.
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [40RTY-ai](https://github.com/40RTY-ai)
- **Source:** [40RTY-ai/shopify-admin-skills](https://github.com/40RTY-ai/shopify-admin-skills)
- **License:** MIT
- **Homepage:** http://skills.40rty.ai
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.