How to Add a Gift Message to Shopify Order Confirmation Without an App

2026-11-08 · support

How to Add a Gift Message to Shopify Order Confirmation Without an App

Shopify's order confirmation email is one of the few places every buyer is guaranteed to look. Adding a gift message there means you can offer a personal touch at checkout without paying for a third-party app or adding another script to your storefront. The trick is to use two native features together: cart attributes (built into Shopify's cart object) and Liquid (the templating language behind every Shopify notification email). This guide walks through the full setup, from the field on the cart page to the rendered message in the confirmation email, plus the limitations you need to know before you rely on it.

Why Add a Gift Message Without an App

Gift message apps typically charge a monthly fee and inject JavaScript into your theme or checkout. For a small store, that's often unnecessary overhead. Shopify already supports custom cart attributes, and every notification template can read them. Doing it natively means:

The tradeoff is that you're editing theme code and notification templates yourself, and the setup only works where Shopify exposes cart attributes to you. More on that in the pitfalls section.

How Shopify Notification Templates and Liquid Work

Shopify notification emails are Liquid templates. Each one—Order Confirmation, Shipping Confirmation, Order Canceled, and so on—lives under Settings → Notifications in your admin. You can edit them directly, and Shopify keeps a default version you can revert to if something goes wrong.

Liquid renders data from the order object. For gift messages, the relevant piece is order.attributes, which is an array of key/value pairs collected from the cart. Each attribute has a .name and a .value. To print the gift message in the confirmation email, you loop through order.attributes and output the value when the name matches the key you chose (for example, Gift message).

Two important details:

  1. Attributes are captured at the cart level and carried onto the order. They appear in the admin under the order's "Additional details" section.
  2. Liquid is whitespace-sensitive in output. Wrap your loop in {%- -%} tags to avoid stray blank lines in the email, and always guard with an {% if %} so orders without a gift message don't render an empty block.

Step 1: Add a Gift Message Field to the Cart or Checkout

Shopify's checkout is locked down for most stores—you can't inject arbitrary HTML into it without Shopify Plus. So the practical place to collect a gift message is the cart page (or a cart drawer), using a standard HTML form field with a name that follows Shopify's attribute convention: attributes[Gift message].

In your theme, open sections/main-cart-items.liquid (or sections/cart-drawer.liquid for drawer-based themes) and add a field inside the cart form, typically near the checkout button:

<p class="cart-attribute__field">
  <label for="gift-message">Gift message (optional)</label>
  <textarea id="gift-message" name="attributes[Gift message]" maxlength="200" placeholder="Add a short note for the recipient"></textarea>
</p>

The name="attributes[Gift message]" part is what matters. Shopify reads any input named that way and stores it as a cart attribute. The maxlength keeps messages short enough to fit neatly in an email; 200 characters is a reasonable default.

If your theme uses a cart drawer with AJAX updates, the field must be inside the form that submits to /cart. Test that the value survives a cart update—some themes re-render the drawer and wipe unsaved inputs.

Step 2: Capture the Message as a Cart Attribute

Once the field exists, Shopify handles capture automatically when the customer clicks Checkout. You don't need to write any JavaScript. To verify it's working before you touch the email template:

  1. Add a product to the cart and type a test message.
  2. Click Checkout and complete a test order (use Shopify's Bogus Gateway in Settings → Payments to avoid real charges).
  3. Open the order in the admin and look under Additional details. You should see Gift message with your test text.

If the attribute doesn't appear, the field name is wrong or the field sits outside the cart form. Fix that before proceeding—the email template has nothing to read otherwise.

You can also confirm attributes render on the cart page itself using {{ cart.attributes['Gift message'] }} in your cart template, which is a useful sanity check.

Step 3: Edit the Order Confirmation Notification Template

Go to Settings → Notifications → Order confirmation and click Edit code. Find a sensible insertion point—after the order summary or near the top of the email body, before the line items, works well.

Add this Liquid block:

{% assign gift_message = nil %}
{% for attribute in order.attributes %}
  {% if attribute.name == 'Gift message' %}
    {% assign gift_message = attribute.value %}
  {% endif %}
{% endfor %}

{% if gift_message != blank %}
  <div style="margin: 20px 0; padding: 16px; border-left: 3px solid #c9a227; background: #faf7ef;">
    <p style="margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: #8a6d1f;">Gift message</p>
    <p style="margin: 0; font-style: italic;">{{ gift_message | escape }}</p>
  </div>
{% endif %}

A few notes on this snippet:

Adjust the colors to match your brand. Preview the template using Shopify's built-in preview, which renders with sample order data—but note the sample data won't include your custom attribute, so you'll need a real test order to see the block.

Step 4: Test the Gift Message End-to-End

Testing is the step most stores skip, and it's where gift message setups fail. Run through this checklist:

If you use a fulfillment app or a 3PL, confirm the attribute appears in the order export they receive. Some integrations only pass line items, not order attributes.

Common Pitfalls and Limitations to Know Before You Ship

Pitfall What happens Fix
Field placed outside the cart form Attribute never saves Move the input inside the <form action="/cart">
Cart drawer wipes inputs on AJAX update Customer types, then loses the message Use a theme that preserves inputs, or a cart page instead of a drawer
Attribute added only at checkout Shopify checkout is not editable on non-Plus plans Collect the message on the cart page
Missing escape filter Broken email layout if the message contains HTML Always pipe through escape
No blank check Empty gift message block on every order Wrap output in {% if gift_message != blank %}
Fulfillment app ignores attributes Warehouse doesn't see the message Check your app's export settings or ask the app's support
Theme update overwrites edits Field disappears after a theme update Note the edit in your theme changelog and reapply after updates

One more limitation worth stating plainly: this approach does not work on the checkout page itself unless you're on Shopify Plus. If you need the gift message field to appear during checkout, you'll need a checkout UI extension (Plus only) or an app that uses Shopify's checkout extensibility. For everyone else, the cart page is the right home for the field.

Also note that cart attributes are per-cart, not per-line-item. If a customer buys three items and wants a different message for each, this setup won't support it. For per-item gift notes, you'd need line item properties instead (properties[Gift note] on the product form), which are read differently in the order object—line_item.properties rather than order.attributes.

Conclusion

Adding a gift message to your Shopify order confirmation without an app comes down to two native features: a cart attribute field named attributes[Gift message] and a small Liquid block in the order confirmation template. The setup takes about 30 minutes, costs nothing, and keeps your checkout free of third-party scripts. Test with a real order before you announce the feature, and document your theme edits so a future update doesn't silently remove the field.

FAQ

Will the gift message appear anywhere other than the confirmation email? Yes. The attribute is stored on the order and visible in the admin under Additional details, in order exports, and in any other notification template where you add the same Liquid block—shipping confirmation and packing slips are common choices.

Can customers edit the gift message after placing the order? Not through the storefront. The attribute is locked to the order once it's placed. If you want to allow edits, you'd handle it manually through customer service or use an app with post-purchase editing.

Does this work with Shopify's new checkout? The cart-page field and the order confirmation template both work on all current Shopify plans. Only the checkout page itself is restricted—adding a field there requires Shopify Plus. Check current Shopify documentation for the latest checkout customization options if you're on Plus.