Tutorial··7 min read

How to Automatically Send Discount Codes to Unhappy Shopify Customers

A well-timed discount code is the cheapest service recovery tool available to a Shopify merchant — cheaper than a refund, and it keeps the customer. Here's how to use them strategically, and how to send them automatically without any manual work.

When a customer emails with a complaint, most merchants face a binary choice: apologize and do nothing, or process a refund. Both leave money on the table. A discount code toward a future purchase is a third option that costs a fraction of a refund, gives the customer something tangible, and — when done right — often turns a frustrated buyer into a repeat one.

The problem has always been execution: manually generating a unique code and including it in a reply requires you to be at your desk, in Shopify, copy-pasting codes into emails. That friction means most merchants don't bother. This guide covers the strategy and how to automate it end-to-end.

Why discount codes work better than refunds for service recovery

A refund costs you 100% of the sale. A 20% discount code costs you 20% of a future sale — which only gets redeemed if the customer comes back. The economics are significantly better.

More importantly, the outcome is different:

  • A refund ends the relationship. The customer gets their money back and has no reason to return.
  • A discount code signals intent to make it right and creates a reason to come back. Customers who redeem a goodwill code often have higher lifetime value than ones who never had an issue — the service recovery paradox is real.
  • Many customers genuinely don't want a full refund. They wanted the product to work. A code that says "try us again and we'll make it right" is sometimes exactly what they were looking for.

When and how much to offer

Not every complaint warrants the same response. A rough framework:

  • Minor issues (slight delay, minor packaging imperfection): 10–15% off next order. Low cost, meaningful gesture, appropriate for small inconveniences.
  • Moderate issues (order arrived later than estimated, item not quite as described): 20–25% off, or free shipping on next order. Enough to feel like a real offer without overcompensating.
  • Significant issues (wrong item sent, damaged product, major delay): code worth 30–50% or equal to the value of the affected item. At this level, the customer has a real grievance and a small code feels dismissive.
  • As a preemptive gesture (shipment is running late and you know it): emailing a code before the customer complains is one of the highest-ROI support moves you can make. It resets expectations before frustration sets in.

Use one-time codes, not blanket discount codes. A one-time code signals that this is a personal gesture for this specific customer — not a generic discount they could have found on a coupon site.

The manual problem: you have to be there

Sending a discount code manually means: reading the email, deciding a code is appropriate, opening Shopify, creating a unique discount, copying it, going back to your email, writing the reply, including the code. That's five context switches for one customer interaction.

At 10 complaints a week it's manageable. At 50 it's a part-time job. And if the complaint arrives on a Saturday evening, it waits until Monday — which is exactly when a frustrated customer decides to dispute the charge instead.

Automating discount codes in customer support replies

Chepa connects to your Shopify store via API and can generate one-time discount codes programmatically — meaning the bot can create a unique code, include it in a reply, and send it to the customer automatically, without any manual steps.

Here's how to set it up:

  1. Connect your Shopify store. In the Chepa dashboard, go to your connection settings and link your Shopify store. This gives the bot read access to orders and write access to generate discount codes.
  2. Enable discount code generation. In the connection settings, toggle on Discount codes. Once enabled, the bot can generate codes when a situation calls for it.
  3. Tell the bot when to use them in your instructions. The bot uses your written instructions to decide when a code is appropriate. Be specific:
    • "If a customer's order is more than 5 days past the estimated delivery date, include a 15% discount code as a goodwill gesture."
    • "If a customer received a damaged item, apologize and include a 30% discount code. Ask them to keep the damaged item."
    • "If a customer asks for a refund and the issue is a shipping delay, offer a 20% code before processing the refund."
  4. Set escalation for large claims. If a customer reports a completely missing order or is threatening a dispute, you want a human involved. Set an escalation address so those emails reach you directly.

With this setup, the bot handles the full loop: reads the complaint, looks up the order, decides if a code is appropriate based on your instructions, generates a unique one-time code via Shopify's API, and sends a warm, specific reply — all automatically, any time of day.

Frequently asked questions

Should I offer a discount or a refund first?

Offer the discount code first. Many customers accept it — especially if it's generous and the complaint was heard clearly. Reserve the full refund for customers who explicitly reject the alternative or whose situation genuinely warrants it.

Won't customers fake complaints to get discount codes?

Some will. The economics still work out — the percentage of customers gaming the system is typically small, and the revenue retained from legitimate service recovery more than covers it. If abuse becomes a pattern from specific customers, you can flag them in your instructions.

Can Shopify generate discount codes automatically?

Yes, via the Shopify API. Tools like Chepa use this to create unique, one-time codes on the fly as part of automated replies — no manual code creation required.

Send discount codes automatically — no manual work

Chepa generates unique Shopify discount codes on the fly and includes them in automated customer replies. Free plan includes 5 emails.

Start for free →