How to Add a Gift Message to Shopify Refund Emails
Gift messages are one of the first things to break when an order gets refunded. A customer buys a birthday gift, types "Happy 30th, Maya!" into the cart note or a gift message field, the recipient opens the package, and then a partial refund lands in the buyer's inbox as a bare, transactional receipt with no context. The gift message you carefully captured at checkout doesn't appear in Shopify's refund notification by default, because that email pulls from a different set of variables than the order confirmation. This guide shows you how to add the gift message back into the refund email, what Shopify's notification editor will and won't let you do, and where the free approach stops working.
Why Gift Messages Vanish on Refunds (and Why It Matters)
Shopify's refund notification is triggered by the refund event, not the order event. Its template has access to order-level data (line items, totals, shipping address) but the default template doesn't render the order's note attributes or cart attributes — the fields where most gift message apps and themes store the message. So even though the data still exists on the order, the refund email simply doesn't print it.
That matters more than it sounds. A refund email is often the only communication a buyer gets after something goes wrong — a damaged item, a wrong size, a canceled preorder. If the order was a gift, the buyer may be managing the refund on behalf of someone else, and the refund email is their paper trail. A refund email that references the gift ("Refund for the gift order to Maya") reads as competent customer service. One that reads like a raw transaction receipt reads like a system that forgot the customer.
There's a second reason: consistency. If your order confirmation, shipping confirmation, and refund email all reference the gift message, the customer experience holds together. If only some of them do, the gap is noticeable.
Before You Edit: What Shopify Refund Emails Can and Can't Do
Shopify's notification templates use Liquid, and you can edit them in Settings → Notifications → Customer notifications → Refund (wording varies slightly by admin version; look for the refund entry in the list of customer notifications). What you can do:
- Insert any order-level Liquid variable, including
order.note,order.attributes, and line item properties. - Add conditional logic with
{% if %}to show a block only when a gift message exists. - Style the block with inline HTML/CSS to match your brand.
What you can't do natively:
- Pull data from a third-party app's private database unless that app writes the message to an order attribute or metafield.
- Send a different refund email based on gift status — Shopify sends one refund notification per refund event per customer.
- Access the original cart attributes if your theme stored the gift message only in a cart attribute and never copied it to the order.
That last point is the most common failure. Before editing anything, open a recent gift order in the admin and check the Additional details / order attributes section. If the gift message is there as a note attribute, you're in good shape. If it's only in the cart, you'll need to fix capture first — most gift message apps (and Shopify's own cart note field) do write to the order, but custom theme code sometimes doesn't.
Step 1: Locate the Right Notification Template
- In Shopify admin, go to Settings → Notifications.
- Under Customer notifications, find Refund (sometimes labeled "Refund confirmation" or similar). Click it.
- Confirm you're editing the customer refund email, not the staff-facing refund notification or the order cancellation email. They're separate templates and editing the wrong one is the most common mistake here.
- Click Edit code. You'll see the HTML/Liquid for the email body.
Take a copy of the current template before you change anything — paste it into a text file. Shopify doesn't version notification templates, so that copy is your rollback.
While you're here, note how the template references line items. Most default refund templates loop through refund.refund_line_items or list the refunded items. You'll place the gift message block near the top of the email body, above the refund summary, so it's the first thing the customer reads.
Step 2: Add the Gift Message to the Refund Email Template
The goal is a block that renders only when a gift message exists. Gift messages typically live in one of two places, so handle both:
- Order note attribute (most common with gift apps):
order.attributes['Gift message']or whatever key your app uses. Check the exact key in a real order's attributes. - Order note (the plain cart note field):
order.note.
Insert this block near the top of the email body, inside the main content container:
{% assign gift_message = order.attributes['Gift message'] | default: order.note %}
{% if gift_message != blank %}
<div style="border-left: 3px solid #1a1a1a; padding: 12px 16px; margin: 0 0 24px; background: #f7f7f7;">
<p style="margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #666;">Gift message on this order</p>
<p style="margin: 0; font-size: 15px; line-height: 1.5; color: #1a1a1a;">{{ gift_message | escape }}</p>
</div>
{% endif %}
Three things to get right:
- Match the attribute key exactly.
'Gift message'is a guess; use whatever your app actually writes. If you use a gift message app, check its documentation or inspect a live order. - Keep the
escapefilter. Gift messages are free text from customers, and unescaped HTML in an email is an injection risk and a formatting mess. - Don't use
order.noteas a fallback if you also use notes for internal instructions. If your team writes fulfillment notes intoorder.note, customers will see them. In that case, drop thedefault:and reference only the attribute.
Save the template. Shopify applies changes immediately to future refund emails.
Step 3: Test With a Real Partial Refund and Full Refund
Don't ship this on a live store without testing both refund types, because Shopify handles them differently in the template.
- Place a test order with a gift message filled in at checkout. Use a real payment method or Shopify's test mode, depending on your setup.
- From the order page, issue a partial refund on one line item. Check the email that arrives — the gift message block should appear above the refunded item summary.
- Issue a full refund on a second test order. Confirm the block still renders and the message text is intact, including apostrophes and line breaks.
- Place a third order without a gift message and refund it. The block should not appear at all — no empty grey box, no stray label.
If the block doesn't render on the partial refund, the most likely cause is that the refund email for partial refunds is the same template but the attribute key differs by order source (e.g., POS vs. online). Check the order's attributes directly in the admin for each test order.
| Test scenario | What to check | Common failure |
|---|---|---|
| Partial refund, gift order | Gift block appears above refunded items | Attribute key mismatch |
| Full refund, gift order | Message text intact, punctuation preserved | Unescaped characters breaking layout |
| Refund, non-gift order | No block, no empty container | Missing {% if %} wrapper |
| Refund after order edit | Message reflects current attribute | Stale data from app sync delay |
Edge Cases: Partial Cancellations, Multiple Items, and Gift Cards
Partial cancellations. A cancellation is a different event from a refund. If you cancel line items, Shopify may send a cancellation email rather than a refund email, and that template needs the same gift block added separately. Check both templates.
Multiple items, one gift message. If a buyer ordered three items and gifted one, the gift message applies to the whole order, not the line item. The block will show on any refund for that order. That's usually fine, but if you sell mixed orders (some gifted, some not), consider asking gift apps to store the message as a line item property instead, which lets you scope the block to refunded line items using refund.refund_line_items.
Gift cards. Gift card orders don't carry shipping details and often skip the gift message field entirely. If you sell gift cards as gifts, capture the recipient's email as a line item property and reference it in the refund template the same way. Shopify's native gift card flow doesn't include a message field, so this usually requires a third-party app or a theme customization.
Refunds issued from Shopify POS or a third-party helpdesk (Gorgias, Zendesk, etc.) still use the same notification template, but the order attributes may not sync instantly. If a support agent issues a refund within minutes of the order being edited, the email can go out with stale data. A short delay before refunding, or a manual check, avoids it.
When a Free Workaround Isn't Enough
The Liquid edit above is free and works for most stores. It stops being enough in a few specific situations:
- You need per-item gift messages. The template approach shows one message per order. If you need to show which item each message belongs to, you need line item properties and a loop, which is more fragile and breaks when apps change their data structure.
- You sell across multiple stores or channels. Editing templates per store is fine for two stores; at five or ten, you want a centralized notification app that templates gift-aware emails once.
- Your team issues refunds from a helpdesk. Apps like Gorgias and Zendesk can trigger Shopify notifications, but the gift block is only as reliable as the attribute sync. A notification platform with native Shopify order data avoids the race condition.
- You want the gift message in the refund email and in the packing slip, order status page, and post-refund follow-up. At that point you're maintaining Liquid in four places, and a dedicated app or a Shopify Flow + notification setup pays for itself in maintenance time.
For stores in that last group, evaluate notification apps (Shopify's own Email app, or third-party options like OrderlyEmails or similar) on three criteria: whether they can read order attributes, whether they support conditional blocks, and whether they let you preview a refund email before sending. Check current pricing directly on each app's listing — it changes, and the free tiers vary a lot.
Conclusion
Adding a gift message to Shopify refund emails is a template edit, not an app purchase, for most stores: find the refund notification, insert a conditional block that reads the order's gift attribute, and test both partial and full refunds before going live. The work is in verifying where your gift message is actually stored and handling the edge cases — cancellations, line-item gifts, and helpdesk-issued refunds — that the default template ignores. Do that once, and your refund emails stop reading like system receipts.
FAQ
Why doesn't my gift message show up in the refund email even though it's on the order? The default refund template doesn't reference order attributes. You have to add a Liquid block that reads the attribute key your gift app or theme uses — check a live order's attributes in the admin to confirm the exact key.
Can I show a different gift message for each refunded item?
Only if the message is stored as a line item property rather than an order attribute. You'd loop through refund.refund_line_items and print the property for each item, which is more complex and depends on how your app stores the data.
Does editing the refund template affect emails already sent? No. Template changes apply only to refund emails sent after you save. Past emails are unchanged, so test on a staging order before editing a live store's template.