My Cart 0

User Manual - Next Order Discount

 

Installing the Magento 2 Next Order Discount extension

Command Line Installation

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

run the following command: :

php bin/magento module:enable Aheadworks_NextOrderDiscount

then:

php bin/magento setup:upgrade

after:

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

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

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

Composer Installation

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

     1. 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/

After the command was executed successfully, you can use the composer to install the extension.

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-next-order-discount

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

composer require aheadworks/module-next-order-discount:<version>

 

Specify the version of the extension in <version>

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

Public Key (Username) and Private Key (Password) | Gift Cart for Magento 2

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

 To upgrade the extension: 

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-next-order-discount

Updater per version:

composer require aheadworks/module-next-order-discount:<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

 

Set up cron

If you have already configured cron jobs for your Magento installation then you can skip this step. Read the following instructions on setting cron job for your Magento store: Magento user guide.

Generally, it would be enough to run in SSH console of your server: 

crontab -e

And insert the following line:  

*/3 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento cron:run
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/update/cron.php
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento setup:cron:run

Remember to confirm the Save request when exiting the installation.

 

 

Uninstalling the Magento 2 Next Order Discount extension

Since Magento introduced declarative Database you need to be very carefull when uninstalling or disabling the module.

NOTE: Please be very careful when uninstalling/disabling this module. This module uses a declarative DB scheme. Once the module is uninstalled the DB tables will be lost.

Manual Removal

1. Disable the module by executing the following commands:

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

2. Remove the extension files from the following folder:

app/code/Aheadworks/NextOrderDiscount

Automatic Removal (via Composer)

1. Disable the module by executing the following commands:

php bin/magento module:uninstall Aheadworks_NextOrderDiscount

 

Extension Compatibility

Module Version Magento Version
As of version 1.0.0 2.4.6 - 2.4.8

The PHP version depends on your current Magento version. Please, refer to your Magento version release notes.

 

 

Introducing Magento 2 Next Order Discount extension

Extension Overview

The Magento 2 Next Order Discount extension helps merchants increase repeat purchases by automatically generating and sending coupon codes for customers’ next orders. Instead of manually creating follow-up promotions, store admins can configure rules that trigger code generation based on order status, order value, and additional conditions.

When a customer places an order and it reaches a specified status, the extension creates a unique discount coupon and sends it to the customer via email, either immediately or after a defined delay. The coupon can be time-limited, formatted according to custom rules, and optionally followed up with reminder emails before expiration.

Key Features

  • Automatic generation of coupon codes for the customer’s next order;
  • Automatic coupon code creation and disabling based on configurable order statuses;
  • Flexible coupon code configuration (expiration, format, prefix/suffix, usage limits);
  • Scheduled coupon delivery with optional delay;
  • Reminder emails for unused coupons before expiration;
  • Customizable email templates for coupon code and reminder emails.

 

Using Magento 2 Next Order Discount

Extension Configuration

To enable the extension, go to Stores > Configuration > AHEADWORKS EXTENSIONS > Next Order Discount.

General Settings

In the General Settings section configure the following options:

  • Is Active – set this option to Yes to enable the extension;
  • Enable debug – set this option to Yes to enable logging to the file. This mode is only for testing purposes.

General Settings | Next Order Discount for Magento 2

 

Discount Coupon Code Settings

These settings define how the coupon code for the next order is created and when it becomes active

  • Cart price rule - select the cart price rule that will be applied to the generated discount coupon. 
Note: To create new rule, please go to: Marketing > Cart Price Rules > Add New Rule
  • Expire after X days – set how long (in days) the coupon will remain valid (Set to 0 to make the coupon never expire);
  • Code length – set the number of characters in the generated coupon code (without prefix, suffix and dashes);
  • Code format – set the format of the coupon code:
    • Alphanumeric;
    • Alphabetical;
    • Numeric;
  • Code prefix –  set the text to be added at the beginning of the coupon code;
  • Code suffix – set the text to be added at the end of the coupon code;
  • Dash – specify how often a dash should be inserted into the coupon code (e.g, setting 4 results in a format like AAAA-BBBB);
  • Create/Enable if order status is – select order status(es) that trigger coupon generation. When an order get one of the selected statuses, a discount code will be created and enabled;
  • Disable if order status is – select order statuses that will disable an existing coupon. This is useful for canceled, closed, or fraudulent orders;
  • Limit – set how many times a customer can receive a next-order discount (e.g. 1 – only after the first order (default), 0 – no limit, coupon is generated after every order).

Discount Coupon Settings | Next Order Discount for Magento 2

 

Email Settings

This section controls how and when discount coupons are emailed to customers.

  • Email template – select the email template used to send the discount coupon code to the customer;
  • Delay time – specify the delay time (in hours) between order placement and sending the discount email (e.g. 0 – send immediately, 1 – send after 60 minutes, 2 - send in 2 hours, etc);
  • Send reminder email – enable/disable reminder emails for unused coupon codes;
  • Reminder before X days – define how many days before coupon expiration the reminder email should be sent (e.g., If a coupon is valid to 2025-01-07 and you will set it for 1 days, then a email will be send at 2025-01-06, 1 day before expire date);
  • Reminder email template – select the email template used for reminder notifications;
  • Sender name – set the name that will appear as the sender of the discount emails;
  • Sender email – set the email address used to send discount and reminder emails.

Email Settings | Next Order Discount for Magento 2

 

Additional Conditions

This section allows you to define additional rule that must be met before a next order discount coupon is generated.

  • Order Minimum Total – set the minimum order grand total required to send a coupon code to the customer (the discount code will be generated only if the order grand total is equal to or greater than this amount).

This helps prevent coupons from being generated for low-value orders and ensures that discounts reward higher-value purchases.

Additional Conditions | Next Order Discount for Magento 2

 

Creating Next Order Discount Email Templates

The extension has two pre-built email templates. To access and customize them, go to Marketing > Communications > Email Templates, and click the Add New Template button

Add New Template Button | Next Order Discount for Magento 2

 

On the opened New Template page, go to the Load Default Template section.

In the Template dropdown menu, locate Aheadworks_NextOrderDiscount section with the following templates:

  • Discount for next order – used to send the discount coupon code to the customer.
  • Remind about discount for next order – used to notify customers before the coupon expires.

Pre-built Templates | Next Order Discount for Magento 2

 

Select the required template and click the Load Template button.

Load Template Button | Next Order Discount for Magento 2

 

The selected template will automatically load its predefined content, which can then be customized as needed.

In the Template Information section there are the following field:

  • Currently Used For – this field shows where the template is currently assigned in the system. This helps admins understand the impact of changes made to the template;
  • Template Name – set an internal name for the template, that will be displayed in the Email Templates table and is used when selecting templates in configuration settings;
  • Template Subject – set the subject line of the email that customers will see in their inbox;
  • Template Content – this field contains the pre-built HTML and variables used to generate the email content. Customize the text, structure, and styling to your needs (but it is recommended to keep the coupon variables to ensure correct functionality);
  • Template Styles – optional field for adding custom CSS styles to control the appearance of the email.

Email Template Customization | Next Order Discount for Magento 2

 

Monitoring Next Order Discount Coupon Codes

To monitor the created via Next Order Discount extension coupon code go to Marketing > Promotions > Cart Price Rule and select the required rule that was selected in the Discount Coupon Settings

Cart Price Rule | Next Order Discount for Magento 2

 

On the opened cart price rule page, scroll down to the Manage Coupon Codes section. 

This table includes the following columns:

  • Coupon Code – the coupon code, automatically created by the extension;
  • Created – the date the coupon code was created;
  • Expiration Date – the coupon expiration date based on the conditions set in discount coupon settings;
  • Order ID – the ID of the order associated with the coupon code;
  • Status – current status of the coupon code (active or inactive);
  • Is Sent – shows whether the email with the coupon code was sent to the customer (yes or no);
  • Used – shows whether the coupon code was used by the customer (yes or no);
  • Times Used – the number of times the coupon has been used. 

Created Coupon Codes | Next Order Discount for Magento 2

 

Report incorrect information

Still Have Questions?

Our customer care team is here for you!

Contact Us