PREREQUISITES:
- Time: 60s
- Access: Sidekick AI
- Plan: Grow / Advanced / Plus
The “Discount Stacking” Trap
It starts with a simple “Welcome” code. Then you launch a “Buy One Get One” automatic discount for a holiday. Before you know it, a customer has used both, stacked a “Free Shipping” code on top, and you’ve just sold a product for less than it cost you to manufacture. Discount stacking is a silent margin killer. If you aren’t monitoring how your discounts collide, you aren’t just giving away profit—you’re paying customers to take your inventory.
The Solution: Sidekick It
To “Sidekick It” is to stop guessing and start auditing. Today, we’re building the Smart Discount Protector (aka the Discount Stacking Shield). This app provides a real-time command center that flags every order where total discounts exceed your safe thresholds. By identifying the “Most Stacked Codes” and calculating “Revenue at Risk,” you can fix your discount logic before the next big sale.
PREREQUISITES
- Shopify Plan: Must be on a plan with Sidekick access (Grow or higher).
- Threshold Knowledge: Determine your “Warning” (e.g., 30%) and “Critical” (e.g., 40%) discount limits based on your COGS.
- Sidekick Access: Ensure the Sidekick icon is active in your admin sidebar.
The Exact Prompt
Build a custom Shopify admin app called "Smart Discount Protector" (subtitle: "Discount Stacking Shield") that monitors and flags orders with excessive discount stacking.Main Dashboard: > - Show 4 analytics cards: Total flagged orders, Average discount %, Total revenue at risk, and Most stacked discount code.Display a table of flagged orders including: Order number (clickable link), Customer, Total, Discount Amount, Discount %, and Status badge (Warning/Critical).Include "Search" and "Time Filters" (24h, 7d, 30d).Logic & Storage: > - Calculate Discount % as: (total discount / (current total + total discount)) × 100.Flag orders above configurable thresholds (Default: 30% Warning / 40% Critical).Store thresholds in shop metafields (namespace: 'sidekick', key: 'discount_protector_settings').Automatically filter out refunded/cancelled orders to prevent false positives.Features: > - Clickable discount codes that open a modal with full details (type, value, start/end dates).Color-coded badges: Orange (Warning), Red (Critical), Blue (Automatic Discount indicator).Pagination and Refresh functionality.
Highlight the text in the box above and copy it to your clipboard to start your build.

How the Shield Protects You
- Continuous Monitoring: The app scans your completed orders across the selected time period.
- Stacking Detection: It doesn’t just look at one code; it sums up Manual Codes + Automatic Discounts to find the true discount percentage.
- Visual Alerting: Orders are instantly color-coded. A “Red” status means the order likely hit your profit floor.
- Actionable Data: By clicking on a flagged code, you can see if that specific promotion is the culprit, allowing you to disable or modify the rule in Shopify immediately.
Technical Note: Post-Purchase Analysis
This app is a monitoring tool, not a checkout blocker. Because Shopify’s checkout is highly secure, this app analyzes orders after they are placed. Use the data gathered here to adjust your “Discount Combination” settings in the Shopify Admin to prevent future stacking.Caution: Set Your Floor
“Critical” thresholds should represent your “Breakeven” point. If your average margin is 45%, a 40% discount is critical because after credit card fees and shipping, you are likely losing money.
Common Questions from the Lab
Does this stop the customer from checking out?
No. It identifies problematic orders once they are completed. If an order is truly disastrous, you can use the clickable order link to jump into the admin and cancel/refund it before fulfillment.
Why does it ignore refunded orders?
Refunded orders often show “100% discount” in data exports because the revenue is zeroed out. The app filters these out so your analytics remain accurate to actual sales.
What is “Revenue at Risk”?
This is the total dollar amount you have “lost” to discounts on flagged orders. It helps you quantify exactly how much stacking is costing your business each month.
The Sidekick Challenge: Run this app for the “Last 30 Days.” What is your Most Stacked Code? If it’s a “Welcome” code stacking with your main sale, it might be time to update your discount combination settings!












