Child pages
  • Gift Card - Magento 2

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Introducing Gift Card extension


The Gift Card extension by Aheadworks introduces a the gift card functionality to the for Magento stores. The gift cards act as regular Magento products with the exception to specifi some specific settings, that control the gift card behavior. In comparison to Magento Enterprisethe default Magento Commerce gift card functionality, the extension introduces offers much more flexibility and management options for the gift card products:

  • Three types if gift cards: virtual, physical, combined;
  • Gift card import and export;
  • Gift card patters;
  • Gift card pool for convenient distribution and management;
  • Delivery date;
  • Personal notes;
  • Email notifications;
  • Magento API support;
  • Responsive design;
  • Integration with Smart One Step Checkout.




  • Gift card - a gift card product that can be purchased from the store;
  • Gift card code/gift code - a unique number of the gift card that can be entered at the checkout;
  • Gift card pool - a set of the gift card codes combined by a certain criteria. The pool can be assigned to the gift card product so all gift card codes will be drawn from it.



One installed Gift Card extension introduces its sections to Products > Gift Card by Aheadworks and Stores > Configuration > Aheadworks extensions > Gift Card.

Gift Card by Aheadworks section contains all sections for the gift card management, while Gift Card settings section defines default behavior of the extension.

Before creating gift cards it is advised configure the extension settings first, as these control overall extension performance

General settings

To access general extension settings proceed to Stores > Configuration > Aheadworks extensions > Gift Card

General settings are represented with a single field Gift Card Expire After (days). It controls after how many days from the order completion the gift card will not be available for use.

Email Settings

Gift Card Notification Email Sender defines from which email address avilable available at the store all notifications will be sent.

Gift Card Code Pattern

Gift Card Code Pattern section defines according to which pattern ALL gift card codes are created at the store, if not overridden on gift card pool level. The following settings are available:

  • Code Length - defines how many symbols the gift card code will contain;
  • Code Format - defines the format:
    • Alphanumeric;
    • Alphabetic;
    • Numeric.
  • Code Prefix - defines the first symbols of EVERY gift card code generated;
  • Code Suffix - defines the last symbols of EVERY gift card code generated;
  • Dash Every X Characters - defines if the sybols symbols of the gift card code are separated by a dash, every X symbols.

Gift Card Code Pattern is also available from the Gift Card Pool settings. When reading about Gift Card Pools consider these options.



There are two ways of creating Gift Card Products, from the Products > Catalog screen or Products > Gift Card by Aheadworks > Gift Card Products.

For the user guide purposes, we will refer to creating a gift card from the Gift Card Product grid.

Gift Card Product grid

Gift Card Product grid is the management center of all gift card products created.

Whether you want to create a gift card product or check how well your gift card products do - this is a screen to refer to. The grid comes with the following control elements:

  • Image Removed button the button allows adjusting the columns available in the gift card products grid, some columns may be excessive and some relevant to your current tasks;
  •  button the button allows looking for particular products matching search criteria;
  • Image Removed button the button allows saving the perfect gift card products grid look you found to quickly load it whenever required.

To add new gift card product click button.

Adding gift card product

The gift card product shares all the setting a native Magento product has, with the exception to of a single section. First, configure the product just as you did with every other Magento product. Then, proceed to the Gift Card Information section.

Gift Card Information section contains numerous gift card settings. For convenience purposes these settings will be split in into two blocks in the other they appear.

  • Card Type - defines the type of the card:
    • Virtual - when purchased the gift card is sent via email;
    • Physical - requires to be shipped and delivered to customer, no email sent;
    • Combined - requires to be shipped to the customer and is sent via email.
  • Pool - defines a Gift Card Pool the gift card code will be taken from, if . If no pull is specified, the gift card will be generated according to the extension settings;
  • Card Description - defines the gift card product description - it is displayed below the product short description before gift card options.

  • Expires After (days) - defines after how many days from order completion the gift card becomes unactiveinactive, overrides extension settings if specified;
  • Custom Message Fields - defines if the field to submit custom message to the gift card is available for customer;
  • Email Templates - a single gift card product can feature different gift card images and email templates to cover different occasions (you can refer to the demo store as an example). Each template added defines new gift card image and text.
  • Amounts - defines the amounts the gift card is available for purchase with;
  • Allow Open Amount - defines if customers can speficy specify gift card amount manually, comes with the limitation options - Open Amount Min/Max Value;

Once done with the gift card options click button. Congratulations! The gift card product has been created and is now available at the store.



When the gift card product is purchased a gift card code is created. It is not the only way to create a gift card code though. The gift card codes can be created manually from the Products > Gift Card by Aheadworks > Gift Card Codes grid and via Gift Card Pools. This section covers gift card management at the Gift Card Codes grid.

Gift Card Codes grid comes with the same control elements as Gift Card Product grid with an addition of and buttons, that, as come comes from their namenames, allow importing and exporting gift card codes.

Gift Card Codes grid offers an overview of all the gift card codes available. Here you can find required gift card code, check its balance, see the order the card has been applied to and customer details. This section offers all the information the store administrator might need to the gift card management.

To create a gift card code click button.

Creating gift card code

Gift card codes share some of the settings with the gift card products, refer to the Adding gift card product section for reference. However, some settings, as sender and recipient are unique as gift cards are supposed to belong to the particular customer.

Delivery date

This section controls when the gift card is delivered.

  • Delivery Date - defines the date of the card delivery;
  • Delivery Date Timezone - defines the timezone of the delivery date to consider time differences if you are working worldwide;
  • Website - defines the website of the gift card.

Sender Details

This section controls from which email address and from whom the gift card is sent. For example, you want to congratulate your customer with on holidays , or edit the existing gift card for the recipient.

Recipient Details

Here the store owner is suggested specifying all the recipient details, editing message and selecting email template the gift card code is sent with.


Once done setting up the gift card code, there are several options, the store administrator can:

  • Save and Send Gift Card;
  • Save;
  • Save and Continue Edit;
  • Reset;
  • Back.



Gift Card Pools are sets of gift card codes, that may differ by the code pattern, event, or any reason you want. For example, you can have a pool of cards you will be selling for Christmas, a pool for Valentine's day, and a pool of cards you have distributed in your physical store.

Using Gift Card Pools

The main reason of for using gift card pools is management - instead of having a long list of all the gift cards for different occasions, different balance etc., you can combine gift cards into pools.

Click button to create a code pool.

  1. The pool settings override extension settings in terms of the gift card code pattern. In the Code Pattern, you specify the look of the codes that will belong to this particular pool.
  2. Next, you can import codes from the .csv file, in case you have a set of already generated codes, and you want them to belong to this pool.
  3. The last section of the code pool is Manage Pool Codes, here you can find and delete codes belonging to the pool.

Once the pool is created it can be assigned to the gift card products. When the gift card product with an assigned pool is purchased, a gift card code is taken from the pool. When the pool is empty the new codes will be generated according to the pool's pattern. If you want to prevent new codes from being generated it is advised to set gift card product quantity equal to the number of codes available in the pool.



If you have previously issued gift card codes for your physical store, or while using a third-party extension, you can import these codes to the extension.

There are two ways to import gift card codes, to the gift card code grid, and to a particular pool. The process behind importing codes is similar for to both scenarios. For the user guide purposes, we will refer to the gift card pool import.

Importing existing code(s)

All codes are imported via .csv files. Depending on whether you are importing to the Gift Card Code grid or to the Gift Card Pool, .csv files will differ. The easiest way of composing the gift card codes is to export existing codes first.

  1. Export existing codes into a .csv file by clicking button.
  2. Open the .csv file in any suitable editor. For example, you can open it in Microsoft Excel.

  3. As per image below you can see how the Gift Card Pool export file looks like. Exsiting Existing codes are maked made blue, and the new ones we are about to upload marked green. Make sure to paste new code the similar way the existing codes are represented.
  4. New codes don't have to be of the same length, have the same prefix or any similarities with the existing codes. You can import any codes you want.
  5. Once you have pasted all the codes to the .csv file click button to upload it.
  6. After a page reload you can check the grid for newely newly imported codes.


Email templates


Depending on gift card product settings, every gift card can be assigned with a particular email template. The extenson extension offers a set of sample email templates that can be edited in the Marketing > Communication > Email Templates.

There are two peculiarities with the Gift Card email templates and Magento templates in general.


Gift Card images are introduced to the email templates with the following variable:

Code Block
var card_image_base_url|raw

So the full line of code may look like:

Code Block
<img src="{{var card_image_base_url|raw}}default.png"> </img>


Due to a Magento issue variable "var logo_url" in the backend preview always returns Luma logo instead of an active logo. This may be confusing.

That's why we suggest updating the store with the following fix:

The issue does NOT affect the actual emails sent, only the store logo in the preview.