How to Add a Gift Message to Shopify Order Confirmation Email
Why Add a Gift Message to Your Shopify Order Confirmation Email?
When a customer buys a gift on your Shopify store, they're often buying from a different address than the recipient and want a note included. If that note never makes it to the recipient, you get two disappointed people and a support ticket. Adding a gift message field to your order confirmation email solves this cleanly: the buyer writes the message at checkout, and it lands in the confirmation email that ships with the order details.
There's a practical side too. Order confirmation emails have some of the highest open rates of any email you'll send — customers open them to verify what they bought. That makes them an ideal place to surface gift information, delivery instructions, or a "this is a gift, no prices included" reminder. If you're running a store where gifting is a meaningful share of orders (jewelry, candles, coffee, baby goods, corporate gifting), this is a small change with an outsized effect on repeat purchases.
This guide walks through the exact steps to add a gift message to your Shopify order confirmation email using Liquid, plus how to test it and when it's worth paying for an app instead.
Before You Start: Accessing Shopify Notification Templates
Shopify's transactional emails live under Settings → Notifications. From there:
- Click Customer notifications to see the list of templates (Order confirmation, Shipping confirmation, Order canceled, and so on).
- Click Order confirmation to open the template editor.
- The editor has two panes: a code view on the left and a preview on the right. You can toggle between Edit code and a visual preview.
A few things to know before editing:
- Back up first. Click the ... menu in the template editor and copy the entire template into a text file. Shopify also keeps a version history you can revert to, but your own backup is faster.
- You need a checkout field for the message. Shopify's native checkout doesn't include a gift message box by default. You'll need a cart attribute or line item property to capture it. The simplest method is a cart note or a custom attribute added via a cart page snippet or a theme app extension. If you haven't set that up yet, do that step first — the email code reads from it.
- Liquid is Shopify's templating language. You don't need to be a developer, but you do need to copy variable names exactly.
Step 1: Locate the Order Confirmation Template
In Settings → Notifications → Order confirmation, scroll to the section where the order summary and customer info appear. You're looking for a spot after the greeting (Hi {{ customer.first_name }}) and before or after the item list, depending on how prominent you want the message.
A good placement is right after the order summary table and before the shipping address block. That way the buyer sees what they ordered, then immediately sees the gift note they wrote, then the delivery details.
If you're using a cart attribute to capture the gift message, the variable will look something like {{ attributes['Gift message'] }}. If you're using a line item property, it will appear inside the line item loop as {{ line_item.properties['Gift message'] }}. Check how your theme or app names the field — the label must match exactly, including capitalization and spacing.
Step 2: Insert the Gift Message Code (Liquid Variables)
Once you've confirmed the attribute name, wrap the output in a conditional so the block only renders when a message exists. Otherwise every non-gift order shows an empty box.
Here's a working pattern for a cart attribute:
{% if attributes['Gift message'] %}
<table class="gift-message" style="margin-top: 20px; border-collapse: collapse;">
<tr>
<td style="padding: 12px; border: 1px solid #e5e5e5; background-color: #fafafa;">
<strong>Gift message:</strong><br>
{{ attributes['Gift message'] }}
</td>
</tr>
</table>
{% endif %}
For a line item property, place this inside the {% for line in line_items %} loop:
{% if line.properties['Gift message'] %}
<p><em>Gift message: {{ line.properties['Gift message'] }}</em></p>
{% endif %}
Two details that matter:
- Use
{{ }}for output, never{% %}. A common mistake is writing{% attributes['Gift message'] %}, which renders nothing. - Escape nothing manually. Shopify auto-escapes output in emails, so you don't need to add HTML entities.
Choosing between cart attributes and line item properties
| Method | Where it's set | Best for | Renders in email as |
|---|---|---|---|
| Cart attribute | Cart page or checkout via cart note/attribute | One message per order | {{ attributes['Gift message'] }} |
| Line item property | Product page or cart line | Different message per item | {{ line.properties['Gift message'] }} |
| Order note | Checkout note field | Buyer instructions to you, not the recipient | {{ note }} |
If you sell gift baskets with multiple recipients in one order, use line item properties. For a single gift message per order, cart attributes are simpler.
Step 3: Test Your Gift Message Setup
Never ship this without testing. Here's the sequence:
- Place a test order on your live store using a real payment method (Shopify's Bogus Gateway works if you have it enabled, or use a 100% off discount code with a real card on file).
- Fill in the gift message field with something distinctive like "TEST GIFT MESSAGE 123."
- Check the confirmation email in the inbox tied to that test customer account.
- Verify the block appears with your message, and that the styling looks right on mobile. Gmail and Apple Mail render tables differently — check both if you can.
- Place a second test order without a gift message and confirm the block does not appear at all.
- Refund or cancel the test orders so they don't pollute your reports.
If you have Shopify's Preview button in the notification editor, use it — but note that previews don't include real order attributes, so the conditional block will typically render as hidden. The live test order is the only reliable check.
Troubleshooting Common Issues with Gift Messages in Shopify Emails
- The message doesn't appear at all. The attribute name in your Liquid doesn't match the name your theme creates. Inspect the order in Shopify admin, look at the Additional details or Notes section, and copy the exact key.
- The block appears on every order, empty. Your
{% if %}conditional is missing or the variable is being output outside it. - The message shows raw HTML tags. The buyer typed HTML into the field. Shopify escapes it by default, so this is usually a sign you've wrapped the output in
| rawor| strip_htmlincorrectly. Remove those filters. - Line breaks are collapsed. Multi-line messages need
{{ attributes['Gift message'] | newline_to_br }}to preserve paragraph breaks. - The message appears in the shipping confirmation too. That's usually desirable, but if not, remove the block from the shipping confirmation template separately — each template is independent.
- Order confirmation isn't sending at all. Check Settings → Notifications → Order confirmation is set to Enabled, and that the customer has a valid email.
Best Practices for Gift Messaging (and When to Use an App)
A few habits that keep this feature useful rather than noisy:
- Keep the field optional and clearly labeled. "Add a gift message (optional)" converts better than a required field.
- Set a character limit — around 200–250 characters — so messages don't break your email layout.
- Add a "This is a gift" checkbox that triggers the message field and suppresses prices on the packing slip. Shopify's packing slip template supports this with a similar conditional.
- Mention gift messaging on the product page for gift-heavy SKUs so buyers know it's available before checkout.
- Consider whether the message belongs on the packing slip rather than the email. Many sellers do both.
When to skip the custom code and use an app: if you need gift wrapping options, scheduled delivery, gift receipts, or per-item messages across a large catalog, a dedicated app is faster than maintaining Liquid. Options in the Shopify App Store include Gift Box, Giftnote, and Gift Wrap. Features and pricing change, so check current pricing and reviews on the App Store listing before installing. For a single store with one gift message field, the code above is free and takes about 15 minutes.
A quick comparison
| Approach | Setup time | Cost | Best for |
|---|---|---|---|
| Custom Liquid in notification template | 15–30 min | Free | Single gift message field, simple stores |
| Cart attribute + theme snippet | 1–2 hours | Free | Stores comfortable editing theme code |
| Gift app | 30 min | Varies — check current pricing | Gift wrapping, gift receipts, multi-item gifts |
Conclusion
Adding a gift message to your Shopify order confirmation email is a small Liquid change that prevents a common customer service headache and makes gift orders feel considered. Set up your capture field, drop the conditional block into the template, and test with two live orders before you call it done. If gifting is a core part of your business, a dedicated app will save you maintenance time — but for most small stores, the code above is all you need.
FAQ
Will the gift message show on the packing slip too? Not automatically. The packing slip is a separate template under Settings → Notifications → Packing slips. Copy the same conditional block into that template if you want it printed.
Can customers edit the gift message after ordering? No — once the order is placed, the attribute is locked. If a customer emails you a correction, edit the order in Shopify admin and update the note or attribute manually before fulfilling.
Does this work with Shopify's new checkout extensibility? Yes, as long as your gift message field is captured as a cart attribute or line item property. Checkout UI extensions can write to cart attributes, and the email template reads them the same way.