Child pages
  • Coupon Code Generator - Magento 2

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width50%

Table of Contents

Warning

Firefox user notice:

Please use different web browser for view this document.

Sorry for the inconvenience.

Column
width30%

Magento 2 Coupon Code Generator allows generating individual coupon codes depending on custom rules. Rules determine the priority, coupon usage, format, coupon conditions, actions, and other parameters and can be attributed to specific websites and customer groups. Moreover, coupons can be designed for individual emails and automatically sent to the recipients selected in a customer database. All generated coupons are tracked from the separate table. 

UI Button
titleProduct Page
colororange
urlhttps://ecommerce.aheadworks.com/magento-2-extensions/coupon-code-generator/
sizelarge

Thank you for choosing Aheadworks!

 


Installing Coupon Code Generator

 

To install the extension follow the instructions below:

Section
Column
width50%

Command Line Installation

Panel
borderStylesolid
borderWidth2px

1. Backup your web directory and store database

Panel
borderStylesolid
borderWidth2px

2. Download Coupon Code Generator installation package

Panel
borderStylesolid
borderWidth2px

 3. Upload contents of the Coupon Code Generator installation package to your store root directory

Panel
borderStylesolid
borderWidth2px

 4. In SSH console of your server navigate to your store root folder:

No Format
cd path_to_the_store_root_folder

run:

No Format
php -f bin/magento module:enable Aheadworks_Coupongenerator

then:

No Format
php -f bin/magento setup:upgrade

after:

No Format
php -f bin/magento setup:static-content:deploy
Panel
borderStylesolid
borderWidth2px

5. Flush store cache; log out from the backend and log in again

Note

Make sure the installation is done from under the FTP administrator account. Otherwise make sure to set 775 permissions to the store root directory after the extension is deployed.

Column
width50%

Composer Installation

Panel
borderStylesolid
borderWidth2px

1. Log in to your customer account at https://ecommerce.aheadworks.com and navigate to Account -> Composer access;

Panel
borderStylesolid
borderWidth2px

2. Configure your store to work with the Aheadworks composer repository:

Add composer repository to composer.json by running:

composer config repositories.aheadworks composer https://dist.aheadworks.com/ in the Magento installation root.

Use a key pair provided as login and pass. You can optionally save them in the global composer auth file.

Panel
borderStylesolid
borderWidth2px

 3. You can start using AW composer now.

 For extension names, navigate to Account -> Composer access.

Panel
borderStylesolid
borderWidth2px

 4. Open the root Magento directory on your server and send Composer the following command:

composer require <component-name>:<version>

Note: Use the previously copied component name and version.

Panel
borderStylesolid
borderWidth2px

 5. Make sure that Composer finished the installation without errors. Flush store cache, log out and log into the backend again.

 


Introducing Coupon Code Generator

Section

Coupon Code Generator extension introduces simple and convenient way of issuing coupon codes:

  • Email delivery options;
  • Individual expiration dates;
  • Coupon use statistics.

The extension enhances the process behind managing and creating coupon codes. With the help of pre-defined email templates, variables and rules, the coupon codes can be generated and sent to a particular customer or customer group in few clicks.

Coupon codes usage allows for the sales campaign tracking and issued coupon codes management.

 


Getting Around

Section

Coupon Code Generator comes set up and ready for work with store default values, no additional manupulations needed.

The extension introduces its pages to the Marketing section the Magento 2 navigation menu. From here store administrator has an access to the following pages:

              • Generate Coupons - the main section where store administrator creates and send the coupon codes to the customers;
              • Manage Coupon Codes - the section where the coupon code related information can be found, also used for reporting purposes;
              • Manage Rules - the section where coupon code rules are created and managed.

These sections are the parts of the Coupon Code Generator "control center". When the extension is configured per administrator's requirements all the management takes place here.

In addition to Marketing section the extension introduces its general configuration options to Stores > Configuration > Aheadworks extensions > Coupon Code Generator. This section controls basic extension aspects such as: Email Sender and Email Template.

 


Creating rules

Section

When the extension is installed the first thing administrator wants to do is to create the coupon code rules. The rules will further be used to quickly generate and send the coupon codes.

The coupon code rules can be created from Marketing > Coupon Code Generator by Aheadworks > Manage Rules

The Manage Rules section provides an overview of all the rules available:

  • Click  button to look through available columns and customize the grid, remove/add columns to match your workflow;
  • Click  button to look for the rules matching a custom set of attributes;
  • Click  button to save a number of custom grid views to switch between, depending on the current task.
These active elements of the grid are shared with the Manage Coupon Codes and Generate Coupon(s) for Customers sections that will be covered later in this readme.

To create a rule click button.

Rule Information

First two blocks of the section, General Configuration and Coupon Usage, should be familiar, as these come with the native Magento.

The third settings block though is new and allows adjusting Code Format. Here store administrator suggested specifying: coupon length, code format, code prefix and suffix, and if the parts of the code shpuld be separated by the dash.

Conditions

This section is similar to the native Magento one. Here store administrator suggested specifying the conditions on which the coupon code can be applied to the shopping cart.

Actions

Is another inherited section. Here store administrator decides on the discount type and amount, quantity and quantity step, and how the discount should handle the shipping.

In addition, administrator can add another set of conditions controlling what items the discount should be applied to.

 

Once done setting up the rule store administrator clicks button.

Now, when the rule is created one can proceed to the Generate Coupons section to issue and send coupons.

 


Generating coupon codes

Section

To generate coupon code with the rule created administrator navigates to Marketing > Coupon Code Generator by Aheadworks > Generate Coupons section.

This section is split into two blocks. The first one Generate Coupon for Email allows generating a single coupon code for a particular email address. The second one Generate Coupon(s) for Customers allows generating coupon codes for selected number of customers.

Generate Coupon for Email

In this block store administrator is suggested specifying the coupon recipient's email, coupon code rule created previously, and decides if the notification email should be send to the customer.

Once every option covered administrator clicks button to issue and send the coupons.

Info

The coupon codes are tied to the email address and cannot be generated without specifying one.

 

Generate Coupon(s) for Customers

In this block store administor is suggested specifying the customer(s) to generate the coupons for. The block comes with the filtering and column management options as the Manage Rules section.

Once the required list of customers is found and ticked, store administrator clicks dropdown menu and decides on the coupon rule and further actions.

The coupon codes have been generated and can now be tracked under Marketing > Coupon Code Generator by Aheadworks > Manage Coupon Codes

Generating coupons from customer account

In addition to the dedicated Marketing section, the extension introduces Coupons block to the customer account area of the store backend.

Here store administrator can quickly issue and send a coupon code while managing the customer. If Send Email with Coupon checkbox ticked upon next customer account save the notification email will be sent.

 


Managing Coupon Codes

Section

Manage Coupon Codes grid offers an insight on the coupon code performance. The block comes with the filtering and column management options as the Manage Rules section.

Here store administrator can access the customer account, see the rule the coupon has been generated with and can delete or deactivate required coupon codes.

In addition, every coupon code issue has the number of uses displayed. As per figure above, we can see that John Doe used the coupon code 4 times, and Jane 3 times. This information may come in handy when estimating the success of the sale campaign.

 


Extension settings

Section

The extension settings can be found under Stores > Configuration > Aheadworks extensions > Coupon Code Generator

Here store administrato has an access to the following settings:

Email Sender - defines the email from which the coupon code notifications will be send;

Email Template - defines the email template which will be send to customer (templates can be found and edited at the FTP of the store under view/frontend/email).


Newsletter and general notification email variables

Coupon Code Generator extension allows sending coupon codes with newsletter and general emails automatically. For such purpose the extension comes with a set of variables for email templates. Once an email is sent variables are transformed into corresponding coupon code values.

 

There is a total of five variables.

VariableDefinition

{{var subscriber.generateCoupon(ruleId, alias)}}

Service variable that generates the coupon code according to defined ruleId. It does NOT add the coupon code to the template

{{var subscriber.getCouponCode(alias)}}

Adds a coupon code to the email template

{{var subscriber.getCouponExpirationDate(alias)}}

Adds coupon code expiration date to the email template

{{var subscriber.getCouponDiscount(alias)}}

Adds coupon code discount to the email template

{{var subscriber.getUsesPerCoupon(alias)}}

Adds a number of coupon code uses to the email template
  • ruleId - instead of the ruleId, the store owner defines an ID of the Coupon Code Generator rule that will be used to create a coupon code;
  • alias - instead of the alias, the store owner defines the preferred name of the coupon code.

 

For example:

Variable {{var subscriber.generateCoupon(1, 50%SHIRT)}} will generate a coupon code 50%SHIRT with the Coupon Code Generator rule ID 1 values.


Info
Expand
titleWhere can I find rule ID?

 

Note

When using Coupon Code Generator variables, one should consider the following:

1) Service variable that generates the coupon code should be placed in the template BEFORE any other extension variable. This variable is used to start the coupon rule.

2) Customer groups are considered in both coupon code rule conditions and follow up email/newsletter conditions.

For example:

If coupon code rule is intended for customer group A.

And follow up email/newsletter is intended for customer group B.

The coupon code will not be generated. The email delivered will come with blanks on the variable positions.

Multiple coupon codes in a single email

To send multiple coupon codes with a single email the store owner adds as many variables as many coupon codes they want to send.

 

For example:


Hello!

We want to you know that currently you can get all WATCHES and BAGS from our store with 20% discount.

{{var subscriber.generateCoupon(1, WATCH20)}}

{{var subscriber.generateCoupon(2, BAG20)}}

For watches use coupon code: {{var subscriber.getCouponCode(WATCH20)}}; to get {{var subscriber.getCouponDiscount(WATCH20)}} discount.

For bags use coupon code: {{var subscriber.getCouponCode(BAG20)}}; to get {{var subscriber.getCouponDiscount(BAG20)}} discount.

Enjoy your shopping!

 

As you can see, variables:

{{var subscriber.generateCoupon(1, WATCH20)}}

{{var subscriber.generateCoupon(2, BAG20)}}

Are used to generate the coupon codes, while variables used later in the template are used to display generated coupon code name (getCouponCode) and discount amount (getCouponDiscount).



Coupon Code Generator integration

Coupon Code Generator is integrated with Follow Up Email extension.

Follow Up Email variables

VariableDefinition

{{var coupongenerator.generateCoupon(ruleId, alias)}}

Service variable that generates the coupon code according to defined ruleId. It does NOT add the coupon code to the template

{{var coupongenerator.getCouponCode(alias)}}

Adds a coupon code to the email template

{{var coupongenerator.getCouponExpirationDate(alias)}}

Adds coupon code expiration date to the email template

{{var coupongenerator.getCouponDiscount(alias)}}

Adds coupon code discount to the email template

  {{var coupongenerator.getUsesPerCoupon(alias)}}

Adds a number of coupon code uses to the email template

The coupon codes are generate the same way as with the native Magento newsletter as has been described above.

Integration with Help Desk Ultimate

Coupon Code Generator extension, when installed along with Help Desk Ultimate by Aheadworks, allows help desk agents generate and send coupon codes directly from the ticket thread.

The extension adds its section to the ticket thread administrator menu. From here help desk agent can select the Coupon Code Generator rule created and reply to the ticket.

The coupon code will be generated automatically according to the rule conditions set and added below the ticket reply, indicating the discount customer gets.

 

UI Button
titleProduct Page
colororange
urlhttps://ecommerce.aheadworks.com/magento-2-extensions/coupon-code-generator/


You can always find the latest version of the software, full documentation, demos, screenshots, and reviews on http://ecommerce.aheadworks.com
License agreement: http://ecommerce.aheadworks.com/LICENSE-M1.txt
Contact Us: http://ecommerce.aheadworks.com/contacts/
Copyright © 2018 Aheadworks Co. http://www.aheadworks.com