Automatic Related Products for Magento 2
- SKU
- M2-AUTOMATIC-RELATED-PRODUCTS
Description / Automatic Related Products for Magento 2
MAGENTO 2 · RECOMMENDATIONS · PROFILES · MERCHANDISING
Match recommendations to the product and the buying stage.
Kowal Related Products Profiles
Design recommendation profiles based on attributes, conditions, and filters. Show matched lists on the product page, in the cart, and in checkout, and supplement or replace native Magento lists.
Conditions and attributes · Grid, Slider, Compact · Related, Upsell, Crosssell
HOW IT WORKS IN PRACTICE
01 · Create a profile
You choose the scope, conditions, and presentation method.
02 · The engine selects products
It applies context, matches, and target filters.
03 · The list appears in the store
It renders in the location selected for the profile.
What does your store gain?
Explore the module features, use cases, and settings.
Meet the module
Build intelligent product recommendations in Magento 2 without being limited to rigid related, upsell, and cross-sell relationships.
Kowal_RelatedProductsProfiles is a module that lets you design your own recommendation scenarios based on profiles, product attributes, activation conditions, target filters, and flexible embedding in the store layout. As a result, recommendations stop being a static list and become part of the store’s sales strategy.
Turn ordinary product lists into real sales scenarios
In standard Magento, related products are often too simple to support more demanding implementations. A store may want to show different products on the product page, different ones in the cart, and different ones in checkout. Sometimes a list should work only for selected customer groups, only during a seasonal campaign, or only when a product meets specific catalog conditions.
This module was built exactly for those cases.
Instead of manually connecting products, you create a recommendation profile. The profile defines:
- where it should work,
- for which product it should activate,
- how to select target products,
- how to narrow and sort them,
- how they should look,
- where they should be rendered,
- and whether they should feed native Magento lists.
One tool, many implementation areas
The module works in the most important areas of the store:
- on the product page,
- in the cart,
- in checkout,
- in native
Related Productsblocks, - in native
Upsell Productsblocks, - in native
Crosssell Productsblocks.
This means one profile can become part of several different merchandising scenarios, and the implementation team does not need to build separate logic for each place in the store.
Profiles that adapt to your catalog
The module’s greatest strength is that recommendations can be built not only manually, but also dynamically based on product attributes.
You can create profiles that:
- select products from the same collection,
- find products with the same graphic,
- show products from the same category,
- promote another product base related to the viewed product,
- narrow results to specific product types,
- work only for selected store views and customer groups.
Example?
A customer views a rashguard with the HALLOWEEN 25 graphic. The profile can automatically find products with the same graphic in other product lines, such as shorts, leggings, or accessories. Another profile can use the same product as context in the cart and suggest that the customer complete the order with products from a selected assortment base.
Create recommendations based on conditions, not exceptions
Each profile can have its own:
Activation Conditions,Matching Rules,Target Product Filters,- sorting,
- product limits,
- rendering variant,
- activity time range.
In practice, this gives you tremendous freedom.
You can build a profile that launches only for products with the brand = Nike attribute, only in the B2C store, only for retail customers, and only during a specific campaign. You can also build a profile that uses a product from the cart as a reference point and suggests add-ons based on shared catalog features.
This is no longer a simple product list. It is a rule-based recommendation engine that can be adapted to the store’s real sales model.
Choose which product should be the context
On the product page, the context is the current product. But in the cart and checkout, that answer is not always obvious. That is why the module lets you define the Context Strategy, meaning the method for selecting the context product.
You can decide that profiles should be based on:
- the first product in the cart,
- the most recently added product,
- the product with the highest price.
This flexibility makes a big difference in projects where the customer adds several different products to the cart and recommendations must follow specific business logic.
Separate scenarios for the product page, cart, and checkout
What works well on the PDP does not always make sense in the cart. The module lets you separate these scenarios without multiplying separate extensions.
On the product page, you can display a list of products from the same collection or the same style. In the cart, you can promote add-ons that increase order value. In checkout, you can prepare a simplified, more cautious list of products supporting cross-sell.
All of this within one profile system.
Feed native Magento lists: append or replace
Not every store wants to give up native Magento mechanisms right away. That is why the module supports integration with:
Related Products,Upsell Products,Crosssell Products.
Each profile can work in one of two modes:
append
keeps native products and adds module results to them,replace
completely replaces the native list with products from the profile.
This is a very convenient implementation solution. You can start with a light extension of existing Magento lists and later move to full recommendation control from the profile level.
Render exactly where you want
A major advantage of the module is the ability to control the rendering location using XML fields assigned to the profile.
Instead of adapting the module to one rigid layout, you can embed the list exactly where the project needs it:
- below the product description,
- below the price,
- below the purchase form,
- in an additional section,
- in a custom theme container,
- in a location resulting from a custom frontend layout.
This is especially important in stores based on extensive or heavily modified themes. The module does not force you into one layout. You decide where and how the profile should be embedded.
Three presentation variants on the frontend
The module does not stop at product selection logic. It also lets you match the list presentation to the page type and implementation style.
Available variants:
Grid,Slider,Compact.
You can use the same recommendation engine both for an expanded section on the product page and for a tight list in the cart or a more compact module in checkout.
You also get control over view elements:
- product name,
- price,
- regular price,
- short description,
- add-to-cart button,
- image role.
Creating new profiles is clear and scalable
The module was built so that an implementation team or agency can develop additional scenarios without rebuilding the entire solution.
When creating a new profile, you configure:
- basic administrative information,
- placements and scope of operation,
- store views and customer groups,
- context strategy,
- activity date range,
- activation conditions,
- matching rules,
- target product filters,
- sorting and display method,
- integration with native Magento lists,
- embedding via XML.
This means that the next merchandising scenario does not immediately require another custom module. Very often, another profile is enough.
1. Same graphic, different product base
A customer views a product from a specific line. Based on matching rules, the module finds products with the same graphic but from other assortment families. This is a great scenario for lifestyle, sports, and fashion brands.
2. Cross-sell based on a cart product
The customer already has a selected product in the cart. The profile uses it as context and selects add-ons that match the purchase but are not manually connected as native cross-sell.
3. Time-limited campaign
Need recommendations that work only during a specific sales campaign? Simply configure a profile with From Date and To Date, without building additional logic.
4. Replacing native upsells
If standard Magento upsells are too simplified, the profile can take over this role and work in replace mode, offering much more precise product matching.
5. Integration with a custom theme
Thanks to XML fields, the list can be embedded exactly where the project frontend requires it, without building another dedicated layout extension.
Who this module is for
Kowal_RelatedProductsProfiles will be especially valuable for:
- Magento 2 implementation agencies,
- software houses developing e-commerce stores,
- merchants who want to make recommendation logic independent from manually maintained relationships,
- projects with an extensive catalog and many business attributes,
- stores using custom themes and complex layouts.
What you gain
When you purchase the module, you get not just another product list, but a tool for designing your own recommendation scenarios in Magento 2.
This solution:
- increases implementation flexibility,
- organizes merchandising logic,
- reduces the need to write additional code exceptions,
- makes better use of catalog attributes,
- lets you grow the store without rebuilding the entire recommendation mechanism.
If the standard related, upsell, and cross-sell options are too limited for your project, Kowal_RelatedProductsProfiles provides a control layer that Magento simply does not have by default.
Current package and additional view control
This description applies to the Kowal_RelatedProductsProfiles engine, available as kowal/module-related-products-profiles. It is a separate package from the earlier Kowal_AutomaticRelatedProducts. During implementation, choose the correct package for the described functionality.
The current code also allows native Related, Upsell, and Crosssell assignments to be rendered in the module template without changing product selection. Appearance settings are available per list, along with controls for moving Related/Upsell blocks.
Implementation requirements
Composer declares PHP in the ^8.1, ^8.2, or ^8.3 ranges and a dependency on kowal/base. After installation, enable the module, create a profile, and check its conditions, time range, cart context, and selected presentation location.
Adjust XML embedding and checkout behavior to the theme you use. Recommendations come from rules and catalog data; the module does not require an AI model for product selection.
Installation via Composer
Package kowal/module-related-products-profiles, module Kowal_RelatedProductsProfiles. After configuring access to the Kowal repository, install the package, enable the module, update Magento, and clear the cache. In production, include compilation and static content deployment according to the store’s process.
From configuration to result
1. Create a profile
You choose the scope, conditions, and presentation method.
2. The engine selects products
It applies context, matches, and target filters.
3. The list appears in the store
It renders in the location selected for the profile.
Same graphic, complementary products
A customer views a rashguard with the HALLOWEEN 25 graphic. The profile compares the graphic attribute and suggests matching shorts, leggings, or accessories from other assortment families.
A second profile can use a product from the cart to suggest completing the order.
Grow recommendations based on catalog data
Want to adapt the module to your store? Ask about implementing Kowal Related Products Profiles and discuss the configuration or required extensions.
More Information
Change Log
Version: 1.1.22
22.05.2026
Added
- Added sample profile installation data patch with three default profiles:
relatedcrosselupsell
- Added native product-page block position management for Related and Upsell blocks.
- Added admin dropdowns for Related and Upsell block positions.
- Added supported product-page position targets:
contentcontent.asidesidebar.mainsidebar.additionalproduct.info.mainproduct.info.mediaproduct.info.details
- Added
related_block_positionandupsell_block_positionprofile fields.
Changed
- Native Magento Related, Upsell and Crosssell injection now replaces the native block output with module-rendered output when the matching checkbox is enabled.
Appendmode now renders native Magento products plus profile products inside the module output.Replacemode now renders only profile products inside the module output.- Related Products defaults to
replacemode. - Admin profile action buttons were moved to the top of the form in Magento-style order:
- Back
- Delete
- Save and Continue
- Save Profile
- Admin ACL/menu integration was aligned with
Kowal_Basemenu structure:Kowal.co > Modules > Related Product Profiles > Profiles- configuration remains under Magento Stores configuration.
Fixed
- Prevented duplicate storefront rendering when a profile is handled by a native Magento list replacement.
- Fixed limited-admin-role visibility for the Profiles menu entry by wiring menu and ACL resources to the Kowal modules tree.
- Preserved native Magento list products for
Appendmode while avoiding recursion during native item collection.
Module Installation Instructions
Module installation and configuration
This document describes the installation of the Kowal_RelatedProductsProfiles module and the basic configuration of a product recommendation profile in the Magento admin panel.
Requirements
- Magento 2 with Composer module support.
- PHP compatible with the project:
^8.1,^8.2, or^8.3. - The base module
kowal/baseinstalled, because the admin menu uses theKowal.co > Modulesstructure. - Administrative access to the Magento CLI.
Installation via Composer
- Add the module repository:
You will receive the Composer repository access credentials, customer email address and license token, by email after purchase. They are also available in the customer panel after logging in at kowal.store. Replace TWOJ_EMAIL_KLIENTA with your account email address and TWOJ_TOKEN with the token you received. Run the commands in the Magento root directory.
composer config repositories.kowal composer https://repo.kowal.store- Configure the access credentials for the Kowal Composer repository:
composer config http-basic.repo.kowal.store 'TWOJ_EMAIL_KLIENTA' 'TWOJ_TOKEN'- Install the module:
composer require kowal/module-related-products-profiles- Enable the module:
php bin/magento module:enable Kowal_RelatedProductsProfiles- Run the database update:
php bin/magento setup:upgradeDuring setup:upgrade, the module creates the profiles table and runs a data patch with three sample profiles: related, crossel, upsell. The patch does not overwrite existing profiles with the same codes.
- In production mode, rebuild dependency injection:
php bin/magento setup:di:compile- Clear the cache:
php bin/magento cache:flushBasic global configuration
Go to:
Stores > Configuration > Kowal > Related Product Profiles
Set:
Enable Frontend Output:YesEnable Debug Logging:Noin production,Yesonly when diagnosing profile behavior
Save the configuration and clear the cache if Magento asks you to do so.
Administrative permissions
The module adds ACL resources for profiles and configuration.
Access to the profile list:
Kowal > Modules > Related Product Profiles > Profiles
Access to configuration:
Stores > Settings > Configuration > Related Product Profiles Configuration
For a demo user who should manage only profiles, assign the Profiles permission. If the user should also change the global module enable setting, assign the configuration resource as well.
Where to manage profiles
The profile list is available in the menu:
Kowal.co > Modules > Related Product Profiles > Profiles
On the list, you can add a new profile, edit an existing one, or delete a profile.
Example configuration of a Related Products profile
The example below creates a profile that replaces the native Magento Related Products block on the product page. Products will be selected by the same attribute_set_id, meaning from the same attribute set as the product viewed by the customer.
1. Create the profile
Go to:
Kowal.co > Modules > Related Product Profiles > Profiles
Click Add New Profile.
2. General section
Set:
Name:Related ProductsCode:relatedIs Active: checkedSort Order:0Placements: selectProduct PageStore Views: selectAll Store ViewsCustomer Groups: selectAll Customer GroupsContext Strategy:First matching itemFrom Date: emptyTo Date: empty
Notes:
- For the product page, the context is always the currently viewed product.
Context Strategyis mainly practical for the cart and checkout.Codemust be unique.
3. Activation Conditions section
Add a condition:
| Attribute Code | Operator | Value |
|---|---|---|
status | Equals | 1 |
Meaning:
- The profile will run only when the context product is active.
- If the condition is not met, the entire profile will be skipped.
4. Matching Rules section
Add a rule:
| Source Attribute | Target Attribute | Operator | Required | Empty Value Policy | Default Value |
|---|---|---|---|---|---|
attribute_set_id | attribute_set_id | Equals | checked | Skip Rule | empty |
Meaning:
- The module will retrieve
attribute_set_idfrom the current product. - Then it will find products with the same
attribute_set_id. Requiredmeans that the target product must satisfy this rule.
Alternative rule examples:
brand->brand, operatorEquals: products from the same brand.category_ids->category_ids, operatorCategory Intersects: products from at least one shared category.color->color, operatorEquals: products in the same color.
5. Target Product Filters section
Add a filter:
| Attribute Code | Operator | Value |
|---|---|---|
status | Equals | 1 |
Meaning:
- Only active products will be shown in the results.
You can optionally add a visibility filter:
| Attribute Code | Operator | Value |
|---|---|---|
visibility | In List | 2,3,4 |
6. Sorting & Display section
Set:
Sort Attribute:entity_idSort Direction:DESCSecondary Sort Attribute: emptySecondary Sort Direction:NoneTitle:Related ProductsSubtitle: emptyProducts Limit:8Template Variant:SliderImage Role:category_page_gridShow Price: checkedShow Old Price: uncheckedShow Add To Cart: checkedShow Product Name: checkedShow Short Description: uncheckedShow Badges: uncheckedHide If Empty: checkedExclude Current Product: checkedExclude Quote Products: checkedExclude Out Of Stock: checked
Meaning of the key fields:
Template Variantcontrols the appearance of the list:Grid,Slider, orCompact.Products Limitlimits the number of products in the results.Exclude Current Productprevents the currently viewed product from being shown in the results.Exclude Out Of Stockremoves unavailable products.
7. Native Magento Lists section
For Related Products, set:
- checkbox
Related Products: checked Mode:ReplacePosition:Magento default position
Meaning:
- Selecting the checkbox means the module takes over the native Magento
Related Productsblock. Replacemeans that only products from the profile will be shown in the taken-over block.Appendmeans that the module will show native Magento products plus products from the profile.Positionlets you move the block to another location on the product page.
Sample positions:
Magento default position: leaves the block in the location set by the Magento theme.sidebar.additional: moves the block to the additional sidebar.sidebar.main: moves the block to the main sidebar.content: moves the block to the main page content.content.aside: moves the block to the side content area.product.info.main: moves the block to the main product information column.product.info.media: moves the block to the product gallery area.product.info.details: moves the block to the product details or tabs area.
If the selected container does not exist in the current theme, Magento will leave the block in the default location.
For Upsell Products and Crosssell Products, leave the checkboxes unchecked in this example.
8. Layout XML section
For this example, leave the fields empty:
Product Page XML: emptyEdit Cart XML: emptyCheckout XML: empty
You do not need to add XML if you use the Native Magento Lists section. XML is useful when the profile should be rendered as an additional module block outside native Magento lists.
9. Save the profile
Click:
Save Profileto save and return to the profile listSave and Continueto save and stay on the form
After saving, clear the Magento cache if the result is not immediately visible on the frontend.
Example Upsell configuration in the sidebar
If you want to move Upsell Products to sidebar.additional:
- In
Placements, selectProduct Page. - In
Native Magento Lists, checkUpsell Products. - Set
Mode:Appendif you want to show native Magento upsells plus profile products.Replaceif you want to show only profile products.
- Set
Position:Additional sidebar - sidebar.additional. - Select
Template Variant: usuallyCompactworks well in the sidebar.
Example Crosssell configuration in the cart
For crosssell:
- In
Placements, selectEdit Cart. - In
Native Magento Lists, checkCrosssell Products. - Set
Mode: most oftenReplace. Positionis not available for crosssell, because positioning currently applies only to blocks on the product page.
Diagnostics
If the profile does not display products:
- Check whether the module is enabled in the configuration.
- Check whether the profile has
Is Activechecked. - Check whether
Placementsmatches the place where you are testing the profile. - Check the conditions in
Activation Conditions. - Check whether the context product has the attribute values used in
Matching Rules. - Temporarily disable
Exclude Out Of Stockif you are testing on products without stock levels. - Enable
Enable Debug Loggingonly for the duration of diagnostics.
Commands after deploying changes
After updating the module, run:
php bin/magento setup:upgradephp bin/magento cache:flushIn production mode, also run:
php bin/magento setup:di:compile