User Manual - Coupon Code Generator

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 a separate table. 

Compatibility: Magento Open Source 2.3.X - 2.4.X, Magento Commerce 2.3.X - 2.4.X

 

 

Installing Coupon Code Generator

Command Line Installation

  1. Backup your web directory and store database
  2. Download the Coupon Code Generator installation package
  3. Upload the contents of the Coupon Code Generator installation package to your store root directory
  4. In the SSH console of your server, navigate to your store root folder:
cd path_to_the_store_root_folder

run the following command: 

php -f bin/magento module:enable Aheadworks_Coupongenerator

then:

php -f bin/magento setup:upgrade

after:

php -f bin/magento setup:static-content:deploy

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

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

Composer Installation

  1. If you are installing an extension from Aheadworks for the first time, you need to add our composer repository to your Magento store:

Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

Run the following command:

composer config repositories.aheadworks composer https://dist.aheadworks.com/

On successful execution of the command you will be able to use the composer to install the extensions.

To install the extension:

     2. Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

 3. Run the following command to install the latest version of the extension:

composer require aheadworks/module-coupongenerator

if you need to install a specific version, run this command:

composer require aheadworks/module-coupongenerator:<version>

 

Specify the version of the extension in <version>

 

When prompted, enter Public Key (Username) and Private Key (Password):

Both Public Key (Username) and Private Key (Password) can be found in My Projects and Licenses in your personal account on our site:

4. Enable the extension:

php -f bin/magento module:enable <Module_Name>

 

Add the product name in <Module_Name>

Next, register the extension:

bin/magento setup:upgrade

Recompile your Magento store if you are in the Production mode:

bin/magento setup:di:compile

To verify that the extension is enabled, run this command:

bin/magento module:status

Clean store cache, by running the following command:

bin/magento cache:clean

Log out and Log in the backend again.

To upgrade the extension:

     5. To update or upgrade an extension:

Download the updated extension file. Take note of the module-name and version. Export the contents to your Magento root.

If a composer package exists for the extension, run one of the following.

Update per module name:

composer update aheadworks/module-coupongenerator

Updater per version:

composer require aheadworks/module-coupongenerator:<version>

Run the following commands to upgrade, deploy, and clean the cache.

php bin/magento setup:upgrade --keep-generated 
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

 

 

Uninstalling Coupon Code Generator

Manual Removal

1. Disable the module by executing the following commands:

php bin/magento module:disable Aheadworks_Coupongenerator 
php bin/magento setup:upgrade

2. Remove the extension files from the following folder:

app/code/Aheadworks/Coupongenerator

Automatic Removal (via Composer)

1. Disable the module by executing the following commands:

php bin/magento module:uninstall Aheadworks_Coupongenerator

 

 

 

Introducing Coupon Code Generator

Coupon Code Generator extension introduces a 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 code usage allows for sales campaign tracking and issued coupon code management.

 

 

Getting Around

Coupon Code Generator comes set up and ready for work with store default values, no additional manipulations 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 the 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

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 on the Columns button to look through available columns and customize the grid, remove/add columns to match your workflow;
  • Click on the Filter button to look for the rules matching a custom set of attributes;
  • Click on the Default View 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 on the Add New Rule 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, an 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 'Save' button.

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

 

 

Generating Coupon Codes

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 on Generate Coupon button to issue and send the coupons.

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 administrator 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, the store administrator expands the Action box 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

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

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.

Variable

Definition

{{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.

 

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

Variable

Definition

{{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 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.

 

 

Product Page

Report incorrect information

Still Have Questions?

Our customer care team is here for you!

Contact Us