User Manual - Refer a Friend
- Installing Refer a Friend
- Installing ShareThis
- Set up cron
- Getting Around
- Refer a Friend Frontend Use
- Backend Configuration
- Other Features
Magento 2 Refer a Friend extension allows creating effective customer referral programs beneficial for all the sides, including Magento merchants, brand advocates, and newly attracted customers. The module includes multiple configuration and management options both on backend and frontend that make it possible to tailor programs to particular business needs, track and improve certain program aspects making it even more valuable for all the participants.
API documentation link
Installing Refer a Friend
Command Line Installation
- Backup your web directory and store database
- Download the Refer a Friend installation package
- Upload contents of the Refer a Friend installation package to your store root directory
- In SSH console of your server navigate to your store root folder:
run the following command:
php bin/magento module:enable Aheadworks_Raf
php bin/magento setup:upgrade
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 under the FTP administrator account. Otherwise, make sure to set 775 permissions to the store root directory after the extension is deployed.
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:
Run the following commands:
composer config repositories.aheadworks composer https://dist.aheadworks.com/
After the command was executed successfully, you can use the composer
To install the extension:
2. Login to your ssh console and navigate to your store folder:
3. Run the following command to install the latest version of the extension:
composer require aheadworks/module-raf
if you need to install a specific version, run this command:
composer require aheadworks/module-raf:<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:
Need to use with Klarna payment method?
Make sure the official module of the payment gateway is installed and proceed with a corresponding command:
composer require aheadworks/module-raf-klarna (for Magento 2.3.* and 2.4.3 and below)
composer require aheadworks/module-raf-mm-klarna (for Magento 2.4.4 and above)
4. Enable the extension:
php -f bin/magento module:enable <Module_Name>
Add the product name in <Module_Name>
Need to use with Klarna payment method?
Make sure the official module of the payment gateway is enabled and proceed with a corresponding command:
bin/magento module:enable Aheadworks_RafKlarna (for Magento 2.3.* and 2.4.3 and below)
bin/magento module:enable Aheadworks_RafMmKlarna (for Magento 2.4.4 and above)
Next, register the extension:
Recompile your Magento store if you are in the Production mode:
To verify that the extension is enabled, run this command:
Clean store cache, by running the following command:
Log out and Log in the backend again.
Want to use the Hyvä theme module?
To install the Hyvä theme module, you need to install the module via composer using command:
composer require hyva-themes/magento2-aheadworks-raf
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-raf
Updater per version:
composer require aheadworks/module-raf:<version>
php bin/magento setup:upgrade --keep-generated
After the extension installation, you can add the ShareThis social bookmarking services to your store in order to facilitate the whole process of sharing for your brand advocates.
1. Create your ShareThis accounts:
2. Follow the provided instructions to add your site to the services. In case you have one of these services working in your store, there is no need to do anything. The functionality will be engaged automatically.
3. As soon as everything is set and launched properly, your brand advocates are able to share their individual referral links via the ShareThis buttons from their customer accounts and across the entire store.
Set up cron
The Refer a Friend extension uses cron for automatic balance checks and customer notifications.
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 will be enough to run in the SSH console of your server the following command:
And insert the following line:
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento cron:run
Don't forget to confirm saving request when exit.
Uninstalling Refer a Friend
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.
1) Run command:
bin/magento module:uninstall --non-composer Aheadworks_Raf
It will remove hide price attributes from the system (e.g. eav_entity_type table).
2) Disable extension:
bin/magento module:disable Aheadworks_Raf
3) Run setup upgrade:
It will remove module related tables from the system (hp_rule_entity, hp_rule_product, etc).
4) Remove module files manually:
Automatic Removal (via Composer)
1) Disable extension:
bin/magento module:disable Aheadworks_Raf
2) Run setup upgrade:
php bin/magento module:uninstall Aheadworks_Raf
4) For completely removing the extension, please proceed with the command:
bin/magento module:uninstall --remove-data Aheadworks_Raf
1.1.6 and earlier versions
2.3.Х - 2.3.6
2.4.0 - 2.4.3
7.4 and earlier versions
As of version 1.1.7
2.4.0 - 2.4.4
As of version 1.2.0
2.4.0 - 2.4.5
As of version 1.2.1
2.4.3 - 2.4.5
As of version 1.2.2
2.4.4 - 2.4.6
The business benefits of the extension are clear and straightforward. It adds new customers and generate more sales, including additional sales made by brand-new customers and purchases from existing ones who act like brand advocates within refer-a-friend programs.
What Makes It Different
In addition to the business advantages brought by the idea of customer referral programs, the module stands out from the bulk of the same solutions with:
- Rewards available for both brand advocates and new customers;
- Integration with ShareThis;
- Rules explained in details for brand advocates and Magento staff;
- Statistics available for individual brand advocates and general data tracking for Magento admins;
- GDPR compliance (right to be forgotten).
The latest versions of the extension (1.2.0) enable the following:
Refer a Friend Frontend Use
Before to offer your customers to take part in the refer-a-friend program, you need to configure the extension according to your needs and preferences. The whole process is described in the Backend Configuration section below. When the configuration finished all the eligible shoppers are able to participate quite easily.
Refer a Frind Frontend Interface
Following the process workflow, Refer a Friend offers brand advocates the Referral Program section added to their customer accounts so they could track and manage their referral activity.
The section includes:
- Detailed refer-a-friend program term explanations, including discounts granted to new customers and rewards provided to brand advocates;
- Performance statistics, such as the number of invited friends, current reward balance, invitation block, and the checkbox to be notified about new rewards.
The invitation block allows brand advocates to generate a referral link and use ShareThis functionality for effective sharing from the account.
In case if a customer leaves the referral group or is excluded from it by Magento admins, the rewards earned can still be applied but the ability to invite new friends is revoked.
In order to make the 'Referral Program' tab visible to customers in their accounts, you need to configure at least one rule on the backend.
The Configuration section is the first step to take when you start using the Refer a Friend extension. Please enter it following Stores → Configuration → AHEADWORKS EXTENSIONS → Refer a Friend → Configuration.
The section consists of two blocks: General and Email Options. The General block makes it possible to set up general settings of the extension as follows below.
- Who Can Invite Friends - determines customer groups eligible to act as brand advocates. There two options you can choose between: a) All Registered Customers and b) Only Registered Customers with Previous Purchases. This way, only registered customers are allowed to invite friends. If the first option is selected, all the registered visitors with or without purchases may participate. The second option allows only customers with orders to enter the program. Additionally, you can determine the type of orders they should have to fit the requirements.
- Order Status - flexibly manipulate with program accessibility for customers with particular order statuses. For example, you can make the program available for the customers who purchased physical products with the 'Processing' status (not yet shipped to them) and for those ones who purchased a virtual item, i.e. the products with the 'Complete' status.
- Customer Groups Which Can Join Referral Program - one more opportunity to shape and finalize the eligible circle of brand advocates is to select them among Magento customer groups. You can do this by using the Customer Groups Which Can Join Referral Program configuration option. This way, the groups that do not participate in the program are not distracted with unnecessary tabs in their customer accounts.
The selector doesn't contain the 'Not Logged In' group as it is unacceptable in any case.
- Order Status to Give a Reward to Advocate - order statuses upon which advocates will receive rewards from the brought friends' purchases.
- Holding period - define whether advocates should get earned rewards instantly or after a particular number of days (specified as a numerical value in this field). It's recommended implementing holding period in order to avoid situations when advocated may get rewards for subsequently canceled orders.
In case if '0' is set or the field is left empty, rewards will be given instantly once orders obtain the appropriate status.
- Maximum RAF Discount Which Can Be Applied to Subtotal, % - the most active brand advocates can earn significant rewards and use them as discounts for their own purchases. So, you can limit its use during the checkout by providing the maximum discount allowed per one order.
- If Unused, Earned Discount Expires in, days - use this configuration option to motivate brand advocates to actively spend their rewards. The expiration date is calculated since the last positive balance update. Hence, it is updated each time a brand advocate attracts a new customer.
- Allow Applying Subsequent Discounts - in case you use other loyalty programs in your store together with the refer-a-friend program, discount application from several programs at once might negatively impact your profit margin. To avoid this, you can limit discount application by disallowing discounts other than refer-a-friend program-related.
- Static Block for Welcome Popup - if you want to facilitate the process of inviting new customers and allow brand advocates to show their attitude towards their friends, you can set up a welcome popup to be displayed for newly attracted visitors. The configuration option makes it possible to determine its content selecting among the Magento static blocks. The popup is not displayed if none of the static blocks are selected.
- Sandbox mode - enable this mode to disable IP validation. Still, it is recommended to use different browsers for testing Advocate and Friend's journeys.
Email Options allow you to сonfigure the notification system of the extension.
- Email Sender. Here, you can specify the email address acting as the sender of all email notifications.
- Email template of Notification About New Friends Reward. This option defines the template to be sent to brand advocates about their new rewards.
- Expiration Reminder Email Template. Here you can set up the email template notifying brand advocates that their rewards expire soon.
- Email Template of Notification About Reward Expiration. Finally, the option defines the template for notifications telling brand advocates that their rewards have been expired.
- Enable Admin Emails Sending. Set to 'Yes' to allow emails to be sent to Admins once an invited customer places an order.
When Enable Admin Emails Sending is set to Yes, the following options appear:
- Admin Email Address - fill in Admin email adress where the emails should be sent.
- ‘Admin Notification’ Email - the default admin notification email template includes the following information: Advocate Name, Advocate Email, URL to the Advocate Account, Friend Name, Friend Email, URL to the Friend Account, Order number, URL to the Order.
Refer a Friend is delivered with some default templates. You can use and customize them or add your own ones.
As soon as the general settings of the extension are configured we can proceed to set refer-a-friend program rules. The main thing is that rules define the rewards earned by brand advocates and the discounts provided for new customers. The Rules section is located along the following path: Marketing > Refer a Friend by Aheadworks > Rules.
Each refer-a-friend rule is applied to one Magento website. So, in case if you manage one website, the module doesn't display the Rules page and grid. Instead, it redirects your immediately to the rule editing page. But, if you have several websites in one Magento installation, you can create a separate rule for each of them.
The Rules grid contains 4 columns:
- Rule name. A custom rule name implied to distinguish it from other rules;
- Rule Status. The column shows whether the rule is enabled or disabled;
- Website. The website a particular rule is assigned to;
- Action. The column allows you to delete or edit rule right on the spot.
The Rules grid is a Magento 2 grid so it allows you to sort and filter grid attributes, customize its view, etc. On this page, you can also create a new rule using the Add Rule button.
The rule editing page contains the following configuration options:
- Rule Name. The text field to be filled with a rule name;
- Rule Status. The box allows you to enable or disable the rule;
- Website. The multi-selector to assign the rule to a particular Magento website;
- Apply to Shipping Amount. The toggle switch button that allows you to choose either applying rewards and discounts to shipping charges or not.
Rule conditions are provided on the same page in a human-readable form. The conditions of the rule can be changed by clicking on the words highlighted with bold font:
- Customer Registration. Set whether friends registration is mandatory to get the discount on their first purchase. We recommend you to set it mandatory in order to avoid the chance that one customer receives several discounts.
- Friend Discounts. Set the discount amount and choose whether it is fixed or % of its first order (see the image above).
- Brand Advocate Rewards. As in the case with friend discounts, these discounts can be either fixed of %. In the case of a percent discount, it is recommended to set the option "Maximum RAF Discount Which Can Be Applied to Subtotal, %" in the General configuration to a reasonable amount, for example to 15%. In this case, even if an advocate has a lot of friends and earned a huge discount, they will not be able to apply more than 15% at a time.
That's it. The rules are configured. Now their terms are clearly displayed in the customer accounts of brand advocates on the frontend.
In order to make the 'Referral Program' tab visible to customers in their accounts, you need to configure at least one rule.
As soon as the rule configuration is finished, the extension is ready to work and invite new customers. So, the next backend section is mostly intended to provide you with additional options to track and manage the program more consciously.
The Advocates section can be found as follows: Marketing → Refer a Friend by Aheadworks → Advocates.
The main page of the section contains the Advocates grid and referral program performance statistics.
The Performance area of the page contains two indicators. Quantity of Orders Made by Friends displays the share of orders made by friends in % out of the total number of orders in the store for last 30 days. Total Amount Made by Friends is the same indicator related to the monetary value of friends' and all website orders.
The Advocates grid comprises the following columns:
- Advocate Name - contains customer names;
- Email - contains customer emails;
- Web Site - displays the web site a customer operates in;
- Invited Friends, Total - shows the number of invited friends by this particular customer;
- Current Balance - balances of rewards earned by brand advocates;
- Nearest Expiration Date - displays the dates of reward expirations.
- Action - contains active links to Advocate Information pages.
Advocate Information Page
The Advocate Information Page contains two distinct areas: Summary and Transactions History.
This area allows you to track the performance of individual brand advocates, including their number of invited friends, current reward balances, and nearest expiration dates.
The Transactions History section area shows the history of all transactions in a dedicated grid. The grid contains the following columns:
- Date. Displays the date when the transaction occurred;
- Action. Describes the essentials of the transaction;
- Amount. Displays balance increments or decrements in green and red accordingly;
- Comment for Admin. Comments to the transactions available to admins;
- Reward Balance. The balance available after the transaction.
The same as any Magento grid, this one makes it possible to sort and filter data and customize the view.
The greatest benefit and value brought by this section is that it allows you to manually update particular reward balances. You can use this opportunity in case of order refunds or in order to additionally award particular brand advocates for their prominent achievements. Each such transaction can be accompanied by comments visible to admins only.
In addition to the functionality described above, the extension also provides some more benefits for store owners and development teams.
GDPR Compliance (Right to erasure)
In order to follow the GDPR requirements, the module erases all refer-a-friend activities in case if a customer profile is deleted.
Web API and Unit Tests
The code of the extension is covered by unit tests and includes REST API, so you can test its compatibility and integrate it with other solutions much easier.
Already used our product?
We would appreciate your feedback. Please, leave a review.