How to Add a Gift Message to Shopify Order Emails
Why Add Gift Messages to Shopify Order Emails (Without an App)
When a customer buys a gift on your Shopify store, the order confirmation email is the first thing they see after checkout. If it looks like a standard receipt with no sign of the gift message they typed in, they start to worry. Did it go through? Will the recipient see it? And if the message never reaches the recipient at all, you get a support ticket, a refund request, or a one-star review.
Most gift message apps charge a monthly fee and add a script to your storefront and checkout. For many small stores, that's overkill. Shopify's native cart attributes and notification templates let you capture a gift message at checkout and surface it in the order confirmation and shipping confirmation emails using Liquid, Shopify's templating language. No app subscription, no third-party script, no data leaving your store.
This guide walks through the full setup: capturing the message, editing both email templates, testing, and troubleshooting. It assumes you're on a Shopify plan that includes checkout customization and notification template editing (all current plans do, but confirm your plan's features before starting).
What You Need Before You Start: Theme Access and a Test Order
Before touching any code, confirm you have:
- Admin access with permission to edit themes and notifications. Staff accounts without theme or settings permissions can't do this.
- A duplicate theme to work in. Go to Online Store > Themes, click the three-dot menu on your live theme, and choose Duplicate. Edit the duplicate, preview it, then publish when it's ready. Never edit a live theme directly.
- Access to notification templates. Go to Settings > Notifications. You'll edit the Order confirmation and Shipping confirmation templates here. These are separate from your theme files and are edited in Shopify's own code editor.
- A test order. Use Shopify's Bogus Gateway (Settings > Payments > enable test mode) or a 100% off discount code so you can place a real order without charging a card. You need a real order to see real email output.
One important limitation to know up front: Shopify's Order confirmation email is sent immediately after checkout, so the gift message must be captured before the order is created. That's why the next step uses cart attributes rather than order notes or metafields added later.
Step 1: Capture the Gift Message at Checkout with Cart Attributes
Cart attributes are key-value pairs attached to the cart, and they carry through to the order. They're the cleanest native way to capture a gift message.
Option A: A cart attribute field on the cart page. Add a textarea to your cart template (cart.liquid or sections/main-cart-items.liquid, depending on your theme) inside the cart form, before the checkout button:
<p>
<label for="gift-message">Gift message (optional)</label>
<textarea id="gift-message" name="attributes[Gift message]" maxlength="200"></textarea>
</p>
Anything named attributes[Your Key] is saved to the cart automatically. Use a clear key like Gift message because you'll reference it exactly in the email templates.
Option B: A line item property. If you sell a specific gift item and want the message tied to that line, use properties[Gift message] inside the line item form instead. Line item properties show up on the order's line items and in the packing slip, which is useful if your fulfillment team reads messages off the slip.
For most stores, Option A is simpler and covers the whole order. If you want the field to appear on the checkout page itself, that requires Shopify Plus checkout extensibility or a checkout UI extension — on non-Plus plans, the cart page is the right place.
Add a maxlength to keep messages short enough to render cleanly in email, and mark the field optional so it doesn't block checkout.
Step 2: Edit the Order Confirmation Template to Show the Message
Go to Settings > Notifications > Order confirmation. Find a sensible spot — usually after the order summary, before the "View your order" button. Insert this Liquid:
{% if attributes["Gift message"] %}
<p><strong>Gift message:</strong></p>
<p>{{ attributes["Gift message"] | escape | newline_to_br }}</p>
{% endif %}
A few things matter here:
attributesis available in the order confirmation email because it's triggered at order creation. In some other notification types it isn't, so always test.escapeprevents a customer from injecting HTML into your email.newline_to_brpreserves line breaks so multi-line messages don't collapse into one paragraph.
If you used a line item property instead, loop through the line items:
{% for line in line_items %}
{% if line.properties["Gift message"] %}
<p><strong>Gift message for {{ line.title }}:</strong><br>
{{ line.properties["Gift message"] | escape | newline_to_br }}</p>
{% endif %}
{% endfor %}
Save the template. Shopify validates Liquid syntax on save and will flag obvious errors, but it won't catch typos in your attribute key — that's what testing is for.
Step 3: Add the Gift Message to Shipping Confirmation Emails
The order confirmation goes to the buyer. The shipping confirmation is where the gift message often needs to reach the recipient, especially if you're shipping directly to them.
Open Settings > Notifications > Shipping confirmation and add the same block:
{% if attributes["Gift message"] %}
<p><strong>A note from the sender:</strong></p>
<p>{{ attributes["Gift message"] | escape | newline_to_br }}</p>
{% endif %}
Use different wording here. "Gift message" reads like internal data; "A note from the sender" reads like a gift. If you ship to the recipient directly, also consider removing or softening the pricing in the shipping confirmation — Shopify lets you edit the line item loop to hide prices.
Note that attributes availability can vary by notification type and Shopify version. If the message doesn't render in the shipping confirmation, the reliable fallback is a note attribute copied to an order metafield, or a small app. Test before publishing.
Testing Your Templates with a Real Test Order
Place a test order with a gift message typed into the cart field. Then:
- Open the order in Orders and check the Additional details or Notes section — your attribute should appear there. If it doesn't, the field isn't saving and the email never will.
- Click Send on the notification you want to test, or use Settings > Notifications > Preview with a sample order.
- Check the actual email in your inbox, not just the preview, since some email clients strip or reflow content.
| Check | Where to look | What it means if it fails |
|---|---|---|
| Attribute saved | Order detail page | Cart form field name is wrong |
| Renders in order confirmation | Test email inbox | Key mismatch or Liquid error |
| Renders in shipping confirmation | Test email inbox | attributes not passed to that template |
| Line breaks preserved | Email body | Missing newline_to_br |
| No raw HTML | Email body | Missing escape filter |
Common Errors and How to Fix Them
- Message appears blank. The attribute key in your template doesn't match the form field exactly.
Gift messageandgift messageare different keys. Match case and spacing. - Message shows as
[object Object]or a hash. You're printing the wholeattributesobject instead of the specific key. Useattributes["Gift message"]. - Message shows in the order but not the email. The template you edited isn't the one being sent, or the customer's email client is caching an old version. Send a fresh test.
- Line breaks disappear. Add the
newline_to_brfilter. - Checkout field doesn't appear. You edited the wrong theme, or the field is outside the cart form tag. It must sit inside the
<form>that posts to checkout. - Message renders but looks broken. Long messages without spaces can overflow. Add
maxlengthto the textarea and aword-wrapstyle.
When a Free App Makes More Sense Than Custom Code
Custom Liquid is the right call when you want zero ongoing cost, full control, and a simple single-field message. It stops being the right call when:
- You need gift wrapping options, gift receipts, or hide-price toggles tied to the message.
- You want the message field on the checkout page itself, not the cart page.
- You sell on multiple channels and need consistent behavior.
- You don't want to maintain Liquid across theme updates.
Several free and freemium apps handle gift messages with a checkbox and a message field, and some bundle gift wrap and price hiding. Check current pricing and reviews before installing — free tiers change, and app quality varies. If your needs stay simple, the native approach costs nothing and adds no page weight.
Conclusion
Adding a gift message to Shopify order emails takes about 30 minutes of careful work: a cart attribute field, two notification template edits, and a real test order to confirm everything renders. The native approach keeps your store lean and your data in Shopify. Test every template before publishing, and only reach for an app when your gift features outgrow a single text field.
FAQ
Will the gift message show on the packing slip or invoice? Only if you add the same Liquid to those templates under Settings > Notifications. Order confirmation and shipping confirmation are separate templates from the packing slip.
Can I add the gift message field to the checkout page instead of the cart? On non-Plus plans, no — checkout fields require Shopify Plus checkout extensibility or a checkout UI extension. On standard plans, the cart page is the supported place.
Does this work on all Shopify themes? Yes, because notification templates are edited in Shopify admin, not your theme. The cart field placement varies by theme, so check your theme's cart template structure before editing.