Child pages
  • Automatic Related Products - Magento 2
Skip to end of metadata
Go to start of metadata


Firefox user notice:

Please use different web browser to view this document.

Sorry for the inconvenience.

Automatic Related Products - Magento 2

Magento 2 Automatic Related Products adds related product blocks to website pages. Products in blocks are displayed in accordance with specific rules regarding block position, name, priority, the pages where the block should be shown, the items to be included in it, the block's look. Automatic product suggestions can be disabled for individual products.

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

Product Page

Thank you for choosing Aheadworks!

Installing Automatic Related Products

Command Line Installation

1. Backup your web directory and store database

2. Download the Automatic Related Products installation package

 3. Upload the contents of the Automatic Related Products 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_Autorelated


php -f bin/magento setup:upgrade


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

5. Flush the 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.

Composer Installation

1. Log in to your customer account at and navigate to Account -> Composer access;

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

Add composer repository to composer.json by running:

composer config repositories.aheadworks composer 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.

 3. You can start using AW composer now.

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

 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.

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


Introducing Automatic Related Products

The Automatic Related Products (ARP) module introduces a powerful set of features for related product offer management:

  • Flexible rules quickly define which items to display as related and on which pages to display a related product block itself;
  • Rule overriding with the native Magento related products (for individual products);
  • Custom block on-page position;
  • Grid (per-row) and slider block layout options.

Getting Around 

The Automatic Related Products extension comes ready for work right after the installation.

Manage Rules

The first place to start is the 'Manage Rules' section available right from the backend navigation menu (Marketing > Automatic Related Products by aheadWorks > Manage Rules).

Manage Rules GridThis is the section where all the Automatic Related Products rule management takes place.

Here you are provided with rule short descriptions and performance stats:

  • Views - displays the number of customer visits to the pages with the ARP block;
  • Clicks - displays the number of clicks on the products displayed in the ARP block (both product clicks and add to cart actions are counted);
  • CTR (Click-through rate) - represents the View-to-Click ratio.

 If you already have one or several rules created, this section provides the following opportunities:

  • navigates you to the 'New Rule' screen where you are suggested to create new related product rules;
  • Clicking a rule name navigates you to the 'Edit Rule' page where you can adjust the created rule settings;
  • and quickly enable/disable the created rules;
  • box deletes a particular rule.

Additionally, the grid displays related product rule priorities and display modes. The rules with higher priority (10 is considered to be higher than 20) are executed first. The 'Display Mode' column shows the 'What to Display' display logic applied to a particular rule (described below).

Creating ARP Rules

The new ARP rules can be created from the 'Manage Rules' section. To create a new rule, follow the steps below:

Step 1

Click . You are now being navigated to the 'New Rule' page.

Step 2

In the 'Rule Information' section, decide on the following:

  • Enable/disable the rule;
  • Choose the ARP block's position in the 'Block Position' field. Currently, there are eleven product page block positions, five shopping cart page positions, two catalog page positions, and the custom position option;
  • Decide on the ARP rule name and type it in the 'Name' field (the name is used for internal identification purposes);
  • Set the ARP block's Priority.

The ARP block's priority comes into play when there are several ARP blocks with the conditions intersected.

For example, if you have two ARP blocks with the same block on-page position, only the ARP block with the highest priority will be displayed.

If these two blocks have the same priority value set, the block created earlier will have the priority over the other.

  • Select the Store View the ARP block should be displayed on;
  • Select Customer Groups the ARP block should be displayed for.

Once done with the above settings, navigate to the 'Where to Display' section:

Step 3

Where to Display Conditions

In the 'Where to Display' section you are suggested to specify the product attributes or attribute combinations defining on which pages the ARP block should be displayed. The module uses the native Magento rules.

Depending on your requirements, you can either:

1) Define a particular set of product pages that will display the ARP block (Example 1);

2) Display the ARP block on all product pages excluding a particular set of product pages (Example 2).

Example 1:

Rule Conditions (Example 1)

Here we specified the product pages where ARP block should be displayed upon adding a category condition.

In this case, the ARP block will be displayed ONLY on the product pages that belong to the 'Sale' category.

Example 2:

Rule Conditions (Example 2)

Here we specified the product pages where the ARP block should NOT be displayed by adding the 'SKU' and 'Color' -based conditions.

In this case, the ARP block will be displayed on ALL product pages of your store except for the ones that fall under the conditions set, namely: products with SKU 1, 2, or 3, and all products of the 'Red' color.

When you are done setting up the display location conditions, navigate to the 'What to Display' section:

Step 4

What to Display Conditions

In the 'What to Display' section you are suggested to choose among the three display options:

  • Conditions Combination;

  • Who Bought This Also Bought (WBTAB);

  • Who Viewed This Also Viewed (WVTAV).


The Who Bought This Also Bought and Who Viewed This Also Viewed display options are only available for the product and shopping cart pages. 

The 'Conditions Combination' option specifies the product attributes or attribute combinations defining the products to be displayed in the ARP block.

The process behind specifying the products is the same as in the Step 3. Depending on your requirements, you either include or exclude products.

With the 'Who Bought This Also Bought' display option, you can select the related products that are frequently bought together with the current product.


The ‘current product’ is either the product displayed on the current product page or the most expensive product displayed on the shopping cart page. The same logic is applied to the 'Who Viewed This Also Viewed' option.

If enabled in the extension settings, the 'Who Viewed This Also Viewed' option selects the products that are frequently viewed together with the current product (consider the above note) within a single browser session.

This display option can be further configured in order to filter particular products from the above selection.

Who Viewed This Also Viewed Display Mode

With the enabled 'Suggest Products from One Category Only' toggle switch button, the extension considers only the items that belong to the category of the current product.

The 'Suggest Products Only with Price Higher than Price of Current Product' option, accordingly, selects only the items with higher prices.

And the combination of these two filters even further narrows down the list of available related products. Suitable for big stores handling numerous visits and sessions.

When you are done with specifying the products you want to be displayed in the ARP block, navigate to the final 'How to Display' section.

Step 5

In the 'How to Display' section you are suggested to adjust the ARP block look's and feel:

  • Set the name of the ARP block that will be displayed to the store customers in the 'Block title' field;
  • Decide on how the ARP block will look like in the 'Block layout' field: grid or slider;
    • If you select the grid block layout option, it will be suggested to specify the number of rows in the block grid;
  • Specify if you want to display under every product in the ARP block with the 'Display "Add To Cart" button' selector;
  • Set the maximum number of products displayed in the ARP block in the 'Max products to display' field;
  • Decide on how you want the related products to be sorted in the ARP block, for example, by bestsellers, low to high prices, the newest, etc.


The sorting orders for the WBTAB and WVTAV display modes are defined by default, by Order Counts and View Counts, accordingly. In the case of the enabled Override Option in the "Related Products, Up-Sells, and Cross-Sells " tab of the backend product editing form the related product blocks using the WBTAB and WVTAV display modes and containing native related products will be sorted by the product positions specified in the corresponding editing form.


If you sort products by newest, users will see the recently added products first (not the recently modified ones).

Once done with the 'How to Display' settings, click . That's it, the rule is now configured.

Overriding Automatic Related Products

The ARP block can be overridden with native Magento related products on the product level. To do this, navigate to Catalog > Products, select the product you want to override with the native Magento rules, and expand the 'Related Products, Up-Sells, and Cross-Sells' section.

General Settings

The 'General Settings' section is available under Stores > Configuration > AHEADWORKS EXTENSIONS > Automatic Related Products

The section contains the two setting blocks:

General. In this block you can:

  • prioritize multiple related product blocks taking the same position (for example, between the blocks with Priority 1 and Priority 5 the extension will display the first one);
  • define the number of days during which the module will process the data on the best-selling products.

Who Viewed This Also Viewed. The setting block enables the ‘Who Viewed This Also Viewed’ display mode and determines the period of processed sessions (e.g. ‘Empty’ means no limitations, which might slow down your website).

Note: If the WVTAV functionality is enabled, the module starts an additional cron job once in 24h updating the related product blocks working under the WVTAV display mode.

Custom Block Position

Automatic Related Products blocks can be displayed in a custom position with the help of the Magento widget. To display a block in a custom position, follow these steps:

Step 1

Create the ARP rule and set the 'Block position' setting to Custom position.

Configure the rest of the settings as you need. Note that you can use the same block for different store views.

Step 2

Create a widget at Content > Elements > Widgets and set the widget type to Automatic Related Products by Aheadworks.

Widget Settings


Besides custom positioning, you can place the related product block instead of the native related and upsell blocks.

Continue to the widget settings. Set layout updates and other widget attributes. Don't forget to navigate to the 'Widget Options' tab and select the required ARP rule.

Step 3

Click . Now you can proceed to the store frontend and see the widget in the specified position.


You can duplicate the rule by expanding the box next to and choosing the 'Save & Duplicate' option.


You can add the ARP block in custom page positions via the template of the corresponding page. Do this by inserting the following snippet in the template:

<?= /* @noEscape */ $block->getLayout()->createBlock(\Aheadworks\Autorelated\Block\Widget\Related::class)->setRuleId(X)->toHtml()?>

, where X in the 'setRuleId' method stands for the ID of the rule that supports custom positioning.



Uninstalling Automatic Related Products

Manual Removal

1. Disable the module by executing the following commands:

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

2. Remove the extension files from the following folder:


Automatic Removal (via Composer)

1. Disable the module by executing the following commands:

php bin/magento module:uninstall Aheadworks_Autorelated

Product Page

Need Customization?

Magento 2 Custom Development Services by Aheadworks

You can always find the latest version of the software, full documentation, demos, screenshots, and reviews on
License agreement:
Contact Us:
Copyright © 2019 aheadworks Co.


  • No labels