Are Your Shopify Discount Codes Costing Margin? | Tugger
All blogs
Shopify AI MCP Claude

Are Your Shopify Discount Codes Winning Customers or Just Giving Away Margin?

One prompt sorts every Shopify discount code into acquiring, subsidising existing customers, or buying one-off sales, with refund rates alongside.

4 min read

Most Shopify stores run discount codes all year: a welcome code in the pop-up, an influencer code, a seasonal sale, a "we miss you" code in the win-back email. Each one was created for a reason. Very few are ever reviewed to see whether they did what they were meant to do. This guide shows how to review all of them in one prompt using Tugger, which syncs your Shopify store into a data warehouse that Claude, ChatGPT and Gemini can query directly.

The question that matters is not "how many times was this code used?" Shopify will tell you that. The question is whether the code brought in new customers who came back and paid full price, or handed a discount to people who were going to buy anyway. That answer is spread across orders, customers and refunds, and it rarely gets asked.

Why Shopify's own reports do not answer this

Shopify's discount reports show usage and total discount value per code. That leaves out the three things that decide whether a code was worth it.

  • Who used it A welcome code used mostly by existing customers is not acquiring anyone. It is a loyalty discount nobody approved.
  • What happened next A code that brings in customers who never order again is buying one-off sales at a loss.
  • How many orders came back Discounted orders often carry higher refund rates, which quietly erodes the margin the code already gave away.

All of that is in your store's data. On each order in ShopifyOrders, discountCodes lists the codes applied, totalDiscountsSet_presentmentMoney_amount records the value given away, subtotalPriceSet_presentmentMoney_amount holds the order subtotal and totalRefundedSet_presentmentMoney_amount shows what was later refunded. The customer_id links every order to a customer, so the AI can look at each customer's full order history before and after they used a code.

How the prompt reaches your Shopify data

Tugger syncs your Shopify store into a managed data warehouse on a schedule, and its built-in MCP server lets Claude, ChatGPT and Gemini query that warehouse directly. If MCP is new to you, our MCP server guide covers it. The connection is read-only: the AI queries the warehouse, never your Shopify admin. Setup is in how to connect Shopify to Claude.

The prompt

Copy this into Claude, ChatGPT or Gemini once your Shopify store is connected to Tugger.

Role: You are an ecommerce trading analyst reviewing the commercial return on discount codes.

Context: Use the ShopifyOrders and ShopifyCustomers data provided via Tugger MCP. Exclude orders where cancelledAt is not null or test is true. Discount codes used on each order are in discountCodes. Discount value is totalDiscountsSet_presentmentMoney_amount, order subtotal is subtotalPriceSet_presentmentMoney_amount and refunds are totalRefundedSet_presentmentMoney_amount. Link orders to customers through customer_id. If the store sells in more than one currency, group by presentmentCurrencyCode.

Task: For every discount code used at least 20 times in the last six months, calculate: orders, gross sales (subtotal before discount) and total discount given; effective discount rate (discount divided by gross sales); new customer share, the percentage of orders where this was the customer's first ever order based on processedAt across all their orders; 90-day repeat rate, meaning of the new customers acquired with the code, the percentage who placed another order within 90 days, and the share of those repeat orders placed without any discount code; and refund rate, refunded value as a percentage of net sales on orders using the code. Exclude new customers acquired in the last 90 days from the repeat rate, because they have not had a full 90 days to come back.

Output: A table sorted by total discount given, highest first, with columns for Code, Orders, Gross Sales, Discount Given, Effective Discount %, New Customer %, 90-Day Repeat %, Full-Price Repeat %, Refund % and Verdict. Use three verdicts: "Acquiring" (new customer share above 60% and repeat rate above 20%), "Subsidising existing customers" (new customer share below 30%) or "One-off buyers" (new customer share above 60% but repeat rate below 10%). Finish with three sentences recommending which codes to keep, change or retire.

What you get back

A single table that sorts your codes into three groups.

  • Acquiring These codes bring in mostly new customers, and a healthy share come back and pay full price. This is what a discount is for. Keep these, and consider whether the discount could be smaller without hurting conversion.
  • Subsidising existing customers Most of the orders come from people who already shop with you. These are often codes that leaked onto voucher sites, or a first-order code without a first-order restriction. The fix is usually a setting in Shopify, not a marketing decision.
  • One-off buyers New customers arrive, take the discount and never return. That may be acceptable for a clearance event. For an always-on influencer code, it means you are paying for sales, not customers.

The refund column often surprises people. A code attached to a 30% discount and a 15% refund rate costs far more per order than the discount report suggests.

Adjusting the thresholds

The verdict thresholds in the prompt (60% new customers, 20% repeat) are starting points for a typical direct-to-consumer store. If you sell something people buy once a year, such as furniture or a gift, change the repeat window from 90 to 365 days. If you sell consumables, 60 days may be more meaningful. Change the numbers in the prompt and run it again; the AI recalculates from the same data.

To see which products absorb the most discount, ask a follow-up using ShopifyOrderLineItemDiscountAllocations, which records the discount allocated to each line item. That shows whether a sitewide code is mostly being spent on your lowest-margin products. For the margin side of the same question, see which Shopify product variants are dragging down your margins.

Related guides

Get started

Without Tugger, this review means exporting orders, writing lookups and rebuilding it every quarter. With Tugger it is one prompt, and the follow-ups are the same conversation. Tugger is UK-based, ISO 27001:2022 certified and connects 70+ systems including Xero, HubSpot, Simpro and Harvest, with no code, no faff. Try Tugger free for 10 days or book a demo.

Read next

More Reasons to Choose Tugger®

Don't just take our word for it.

It’s helped me keep my finger on the pulse of each department without having to be down in the trenches to get that pulse.
Matthew Skoglund
General Manager · West Crane Services
Working with the AI agent through Tugger, blending Simpro, Xero and my other systems together, I came up with a really detailed, factual investigation.
Jeff Smith
Partner & Director of Digital Disruption · Envirotech Group
One of our customers wants a monthly evaluation pack built from thousands of Simpro jobs. It used to take a full day. Now our data reaches Claude through Tugger and the pack comes back in ten minutes, exactly how they want it.
John Trickett
Head of Digital & Technology · Severnside Security Limited
Batch invoicing and reporting used to eat hours of admin time each week, chasing details back and forth between Simpro and our spreadsheets. Now it runs on its own, and because Tugger guides the AI to the right figures, I can trust what comes out.
Beau Berg
Operations Manager · Australian Airport Services