Skip to main content
All CollectionsIntegrationsShopify
Import Shopify gift cards into Wrapped from default Shopify gift card emails
Import Shopify gift cards into Wrapped from default Shopify gift card emails

Modify your Shopify gift card email templates so gift cards can be imported into Wrapped automatically.

Matt Thomas avatar
Written by Matt Thomas
Updated over a week ago

Sometimes, it makes sense to generate gift cards out of Shopify (e.g. a refund to gift card from Shopify POS) and have these imported into Wrapped so they can be synced to your other sales channels. A challenge is that Shopify gift cards can only be imported into 3rd party systems (like Wrapped) if the full gift card code is known.

Fortunately, there is a way to do this but modifying the default Shopify gift card notification templates:


Update default Shopify "new gift card" email notification template

1. Locate the gift card template in Shopify admin dashboard by navigating to
Settings > Notifications > Customer Notifications > Gift Cards > New gift card


2. Click "Edit code":

3. We will be updating the Email Body (HTML) value so we recommend taking a back-up. Copy the text and save it to a text file in case you need to revert.

4. Next we will change the email template so the user needs to "Activate their gift card" to view the code. This will send the user to Wrapped so the code can be viewed (and import the gift card).

To do this, find and remove references {{ gift_card.code | format_code }}. Change button text to "Activate gift card" and any link and button URLs to:
https://manage.wrappedgiftcards.com/Preview/GiftCardByAccount/6443bc5a8f7a3b15c91ac161?code={{ gift_card.code }}

Here's a code snippet you can use:

{% if gift_card.recipient %}
{% if gift_card.customer %}
{% if gift_card.customer.name != blank %}
{% assign sender_name = gift_card.customer.name %}
{% elsif gift_card.customer.email != blank %}
{% assign sender_name = gift_card.customer.email %}
{% else %}
{% assign sender_name = gift_card.customer.phone %}
{% endif %}
{% else %}
{% assign sender_name = shop.name %}
{% endif %}

{% if gift_card.recipient.nickname != blank %}
{% assign recipient_name = gift_card.recipient.nickname %}
{% elsif gift_card.recipient.name != blank %}
{% assign recipient_name = gift_card.recipient.name %}
{% else %}
{% assign recipient_name = gift_card.recipient.email %}
{% endif %}

{% capture email_title %}
Hi {{ recipient_name }}, you have received a gift card from {{ sender_name }}.
{% endcapture %}
{% endif %}

<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ email_title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/assets/notifications/styles.css">
<style>
.button__cell { background: {{ shop.email_accent_color }}; }
a, a:hover, a:active, a:visited { color: {{ shop.email_accent_color }}; }
</style>
</head>

<body>
<table align="center" class="body giftcard__body">
<tr>
<td class="empty-line">&nbsp;</td>
</tr>
<tr>
<td class="empty-line">&nbsp;</td>
</tr>
<tr>
<td>
<table class="row content">
<tr>
<td class="content__cell">
<center>
<table class="container">
<tr>
<td>

{% if gift_card.recipient %}

{% if shop.email_logo_url %}
<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{shop.email_logo_url}}" alt="{{ shop.name }}" class="giftcard__logosize" width="{{ shop.email_logo_width }}">
</td>
</tr>
</table>
{% endif %}

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__title">{{ email_title }}</td>
</tr>
</table>

{% if gift_card.recipient and gift_card.message != blank %}
<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__message">
"{{ gift_card.message }}"
</td>
</tr>
</table>
{% endif %}

<table align="center" class="giftcard__topmargin">
<tr>
<td class="giftcard__balance">{{ gift_card.initial_value | money_with_currency }}</td>
</tr>
{% if gift_card.expires_on %}
<tr>
<td class="giftcard__smalltext">
Expires {{ gift_card.expires_on | date: '%B %e, %Y' }}
</td>
</tr>
{% endif %}
</table>

<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{ 'gift-card/card.jpg' | shopify_asset_url }}" alt="Gift card image" width="240" height="160">
</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__shop_name">{{ shop.name }}</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__smalltext">
Use your gift card online or instore
</td>
</tr>

</table>

<table class="row actions">
<tr>
<td class="actions__cell">
<table align="center" class="button">
<tr>
<td class="button__cell"><a href="https://manage.wrappedgiftcards.com/Preview/ShopifyGiftCard?code={{ gift_card.code }}&shopifyDomain={{shop.url}}" class="button__text">Activate gift card</a></td>
</tr>
</table>
<table align="center" class="button">
<tr>
<td class="link__cell"><a href="https://manage.wrappedgiftcards.com/Preview/ShopifyGiftCard?code={{ gift_card.code }}&shopifyDomain={{shop.url}}" class="link__text">View gift card balance or use in-store</a></td>
</tr>
</table>
</td>
</tr>
</table>

{% if gift_card.pass_url %}
<table align="center" class="row">
<tr>
<td class="giftcard__textcenter">
<a href="{{ gift_card.pass_url }}" class="apple-wallet-button">
<img src="{{ 'gift-card/add-to-apple-wallet.png' | shopify_asset_url }}" alt="Add to Apple Wallet" width="120" height="40">
</a>
</td>
</tr>
</table>
{% endif %}

{% else %}

{% if shop.email_logo_url %}
<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{shop.email_logo_url}}" alt="{{ shop.name }}" class="giftcard__logosize" width="{{ shop.email_logo_width }}">
</td>
</tr>
</table>
{% endif %}


{% if gift_card.recipient and gift_card.message != blank %}
<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__message">
"{{ gift_card.message }}"
</td>
</tr>
</table>
{% endif %}

<table align="center" class="giftcard__topmargin">
<tr>
<td class="giftcard__balance">{{ gift_card.initial_value | money_with_currency }}</td>
</tr>
{% if gift_card.expires_on %}
<tr>
<td class="giftcard__smalltext">
Expires {{ gift_card.expires_on | date: '%B %e, %Y' }}
</td>
</tr>
{% endif %}
</table>

<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{ 'gift-card/card.jpg' | shopify_asset_url }}" alt="Gift card image" width="240" height="160">
</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__shop_name">{{ shop.name }}</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__smalltext">
Use the gift card instore or online
</td>
</tr>
</table>

<table class="row actions">
<tr>
<td class="actions__cell">
<table align="center" class="button">
<tr>
<td class="button__cell"><a href="https://manage.wrappedgiftcards.com/Preview/ShopifyGiftCard?code={{ gift_card.code }}&shopifyDomain={{shop.url}}" class="button__text">Activate gift card</a></td>
</tr>
</table>
<table align="center" class="button">
<tr>
<td class="link__cell"><a href="https://manage.wrappedgiftcards.com/Preview/GiftCardByAccount/6443bc5a8f7a3b15c91ac161?code={{ gift_card.code }}" class="link__text">View gift card balance or use in-store</a></td>
</tr>
</table>
</td>
</tr>
</table>

{% if gift_card.pass_url %}
<table align="center" class="row">
<tr>
<td class="giftcard__textcenter">
<a href="{{ gift_card.pass_url }}" class="apple-wallet-button">
<img src="{{ 'gift-card/add-to-apple-wallet.png' | shopify_asset_url }}" alt="Add to Apple Wallet" width="120" height="40">
</a>
</td>
</tr>
</table>
{% endif %}

{% endif %}

</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
<table class="row footer">
<tr>
<td class="footer__cell">
<center>
<table class="container">
<tr>
<td>

<p class="disclaimer__subtext">If you have any questions, reply to this email or contact us at <a href="mailto:{{ shop.email }}">{{ shop.email }}</a></p>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>

<img src="{{ 'notifications/spacer.png' | shopify_asset_url }}" class="spacer" height="1" />

</td>
</tr>
</table>
</body>
</html>


5. Save changes. The resulting email template should look something like this:


6. Finally, run a test. From Shopify admin dashboard, navigate to
Products > Gift cards > Create gift card


Add yourself as a customer and check "Send gift card now".


You will receive an email based on the updated template:


Clicking "Activate gift card" will import the gift card into Wrapped and load the gift card:




Update default Shopify "new gift card" email notification template

Follow the instructions above, choosing to update "Gift card receipt" notification template.

Take a back-up and update the Email Body HTML field.

Here's a code snippet that can be used

{% if gift_card.recipient %}
{% if gift_card.recipient.nickname != blank %}
{% assign recipient_name = gift_card.recipient.nickname %}
{% elsif gift_card.recipient.name != blank %}
{% assign recipient_name = gift_card.recipient.name %}
{% else %}
{% assign recipient_name = gift_card.recipient.email %}
{% endif %}
{% capture email_title %}
{% if gift_card.send_on != blank %}
Here's your gift card that will be sent to {{ recipient_name }} on {{ gift_card.send_on | date: '%B %e, %Y' }}.
{% else %}
Here's your gift card that was sent to {{ recipient_name }}.
{% endif %}
{% endcapture %}
{% endif %}

<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ email_title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/assets/notifications/styles.css">
<style>
.button__cell { background: {{ shop.email_accent_color }}; }
a, a:hover, a:active, a:visited { color: {{ shop.email_accent_color }}; }
</style>
</head>

<body>
<table align="center" class="body giftcard__body">
<tr>
<td class="empty-line">&nbsp;</td>
</tr>
<tr>
<td class="empty-line">&nbsp;</td>
</tr>
<tr>
<td>
<table class="row content">
<tr>
<td class="content__cell">
<center>
<table class="container">
<tr>
<td>


{% if shop.email_logo_url %}
<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{shop.email_logo_url}}" alt="{{ shop.name }}" class="giftcard__logosize" width="{{ shop.email_logo_width }}">
</td>
</tr>
</table>
{% endif %}

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__title">{{ email_title }}</td>
</tr>
</table>

{% if gift_card.recipient and gift_card.message != blank %}
<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__message">
"{{ gift_card.message }}"
</td>
</tr>
</table>
{% endif %}

<table align="center" class="giftcard__topmargin">
<tr>
<td class="giftcard__balance">{{ gift_card.initial_value | money_with_currency }}</td>
</tr>
{% if gift_card.expires_on %}
<tr>
<td class="giftcard__smalltext">
Expires {{ gift_card.expires_on | date: '%B %e, %Y' }}
</td>
</tr>
{% endif %}
</table>

<table align="center" class="giftcard__doubletopmargin">
<tr>
<td>
<img src="{{ 'gift-card/card.jpg' | shopify_asset_url }}" alt="Gift card image" width="240" height="160">
</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__shop_name">{{ shop.name }}</td>
</tr>
</table>

<table align="center" class="row giftcard__topmargin">
<tr>
<td class="giftcard__smalltext">
Use the gift card online or in-store
</td>
</tr>
</table>

<table class="row actions">
<tr>
<td class="actions__cell">
<table align="center" class="button">
<tr>
<td class="button__cell"><a href="https://manage.wrappedgiftcards.com/Preview/GiftCardByAccount/6443bc5a8f7a3b15c91ac161?code={{ gift_card.code }}" class="button__text">Activate gift card</a></td>
</tr>
</table>
<table align="center" class="button">
<tr>
<td class="link__cell"><a href="https://manage.wrappedgiftcards.com/Preview/GiftCardByAccount/6443bc5a8f7a3b15c91ac161?code={{ gift_card.code }}" class="link__text">View gift card balance</a></td>
</tr>
</table>
</td>
</tr>
</table>

{% if gift_card.pass_url %}
<table align="center" class="row">
<tr>
<td class="giftcard__textcenter">
<a href="{{ gift_card.pass_url }}" class="apple-wallet-button">
<img src="{{ 'gift-card/add-to-apple-wallet.png' | shopify_asset_url }}" alt="Add to Apple Wallet" width="120" height="40">
</a>
</td>
</tr>
</table>
{% endif %}


</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
<table class="row footer">
<tr>
<td class="footer__cell">
<center>
<table class="container">
<tr>
<td>

<p class="disclaimer__subtext">If you have any questions, reply to this email or contact us at <a href="mailto:{{ shop.email }}">{{ shop.email }}</a></p>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>

<img src="{{ 'notifications/spacer.png' | shopify_asset_url }}" class="spacer" height="1" />

</td>
</tr>
</table>
</body>
</html>


The resulting template should look something like this:

Did this answer your question?