This is an old revision of the document!
Table of Contents
The gift card email template is different from the regular Foxy email receipt templates. This article gives you some more information about how the template works, provides some simple examples of how to customize it, and lists the variables available.
Our gift card email template uses the MJML email framework. You can review the documentation for the framework here: MJML. Note that you don’t need to install it. If you want to dive into that documentation and really learn it, you can being with Getting Started at that link.
Otherwise, you can follow this article and refer to the MJML documentation if needed. Note that at the time of this writing, we are transitioning to a new Foxy admin, and the admin referred to in this article is the one at https://admin.foxy.io, rather than the legacy admin.
To get started with customizing the template, you can get the code from our templates GitHub repo here: Gift Card Email Template.
Copy the code there to your computer’s clipboard, and then you can either paste it into a plain text editor or work with it directly in the admin, if desired. Information on entering the template into the admin is included below, under Add Your Custom Template.
Styling the Template
You can add your own styles to this template by altering or adding your own inline styles to the individual elements.
Using Twig
You can use the Twig templating syntax to create conditions and add more information to the receipt. We have an example of conditionally adding the transaction ID to the template when the email address on the gift card is the store email. In this use case, the store wants to offer an option for a physical gift card. The product add-to-cart is set up so that the gift recipient email address is set to the store email (and hidden) when the customer opts to purchase a physical gift card. That address is then used to create the conditions to add the Transaction ID to the template. Additional fields, such as the mailing address for the card, could be added. The example is at PasteBin here: https://pastebin.com/raw/PkdT4WNY
Available Twig Variables
Gift Card Language:
{{ lang.gift_card_header }}
{{ lang.from }}
{{ lang.code }}
{{ lang.start_shopping }}
Store Data:
Transaction Data:
```transaction_data.id transaction_data.display_id transaction_data.is_test transaction_data.hide_transaction transaction_data.data_is_fed transaction_data.type transaction_data.source transaction_data.transaction_date transaction_data.locale_code transaction_data.customer_first_name transaction_data.customer_last_name transaction_data.customer_tax_id transaction_data.customer_email transaction_data.customer_ip transaction_data.ip_country transaction_data.user_agent transaction_data.total_item_price transaction_data.total_tax transaction_data.total_shipping transaction_data.total_future_shipping transaction_data.total_order transaction_data.status transaction_data.date_created transaction_data.date_modified transaction_data.currency_code transaction_data.currency_symbol```
Items (Array):
```items_.item_category_uri items_.name items_.price items_.quantity items_.quantity_min items_.quantity_max items_.weight items_.code items_.parent_code items_.discount_name items_.discount_type items_.discount_details items_.subscription_frequency items_.subscription_start_date items_.subscription_next_transaction_date items_.subscription_end_date items_.is_future_line_item items_.shipto items_.url items_.image items_.length items_.width items_.height items_.expires items_.date_created items_.date_modified```
Item Options:
Gift Card Codes:
Add Your Custom Template
To add your custom template to your store: 1. In the Foxy admin at admin.foxy.io, go to Settings→Emails. 2. Scroll down to Templates and select your desired gift card email template. If you don’t see anything there, you should review our main gift card documentation on setting up the gift card email here: https://wiki.foxycart.com/v/2.0/gift_cards 3. Under the HTML Template option, select Upload source code. 4. Paste your custom template code into the Source text box and click Save.