Automatic Related Products for Magento 2
Magento Modules: Clear Guidelines
You purchase the module once, with no domain restrictions
Free installation and updates via Composer
Affiliate Program
Technical support for Magento
Clear guidelines for licensing Magento modules
Magento Module Code Security
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 placement in the store layout. As a result, recommendations stop being a static list and become part of your store sales strategy.
Turn simple product lists into real sales scenarios
In standard Magento, related products are often too basic to support more demanding implementations. A store may need 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 the product meets specific catalog conditions.
This module was built exactly for those use cases.
Instead of manually linking products together, you create a recommendation profile. The profile defines:
- where it should work,
- which product should activate it,
- 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 every location in the store.
Profiles that adapt to your catalog
The module 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 is viewing 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 the context in the cart and suggest that the customer add products from a selected assortment base to the order.
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 date range.
In practice, this gives you a great deal of flexibility.
You can build a profile that runs 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 cart product as the reference point and suggests add-ons based on shared catalog attributes.
This is no longer a simple product list. It is a rule-based recommendation engine that can be adapted to the store 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, which is the method for selecting the contextual 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 adding multiple 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 within a single 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
fully replaces the native list with products from the profile.
This is a very convenient implementation approach. You can start by lightly extending current Magento lists and later move to full recommendation control from profiles.
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 place 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 required by a custom frontend layout.
This is especially important for stores based on advanced or heavily customized themes. The module does not force you into a single layout. You decide where and how the profile should be embedded.
Three frontend presentation variants
The module does not stop at product selection logic. It also lets you adjust how the list is presented to match the page type and implementation style.
Available variants:
Grid,Slider,Compact.
This means you can use the same recommendation engine for both an expanded section on the product page and a compact 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 or agency team 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 another merchandising scenario does not immediately require another custom module. Very often, another profile is enough.
Real-world use cases
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 fit the purchase but are not manually linked as native cross-sell items.
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 simplistic, a 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 of manually maintained relationships,
- projects with an extensive catalog and many business attributes,
- stores using custom themes and complex layouts.
What you gain
When you buy the module, you get not just another product list, but a tool for designing your own recommendation scenarios in Magento 2.
It is a solution that:
- 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 standard related, upsell, and cross-sell are too limited for your project, Kowal_RelatedProductsProfiles gives you a control layer that Magento simply does not provide by default.
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. - Installed base module
kowal/base, because the admin menu uses theKowal.co > Modulesstructure. - Administrative access to the Magento CLI.
Installation via Composer
- Add the module repository:
composer config repositories.related.products.profiles vcs https://github.com/kowalco/related-bestsellers- If the repository is private, add a GitHub token:
composer config --global --auth github-oauth.github.com - 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- Flush 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 flush cache if Magento asks you to.
Admin 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, grant the Profiles permission. If the user should also be able to change the global module enable setting, grant 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 Related Products profile configuration
The following example 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 relevant 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 the target product must meet 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 with 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 most important fields:
Template Variantcontrols the list appearance:Grid,Slider, orCompact.Products Limitlimits the number of products in the results.Exclude Current Productprevents the currently viewed product from appearing in the results.Exclude Out Of Stockremoves unavailable products.
7. Native Magento Lists section
For Related Products, set:
Related Productscheckbox: checkedMode:ReplacePosition:Magento default position
Meaning:
- Selecting the checkbox means the module takes over the native Magento
Related Productsblock. Replacemeans only products from the profile will be shown in the taken-over block.Appendmeans the module will show native Magento products plus products from the profile.Positionlets you move the block to another location on the product page.
Example 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, flush 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, selectUpsell 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: usuallyCompactfits well in the sidebar.
Example Crosssell configuration in the cart
For crosssell:
- In
Placements, selectEdit Cart. - In
Native Magento Lists, selectCrosssell 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 Activeselected. - Check whether
Placementsmatches the location where you are testing the profile. - Check the conditions in
Activation Conditions. - Check whether the context product has values for the attributes used in
Matching Rules. - Temporarily disable
Exclude Out Of Stockif you are testing on products without stock quantities. - 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:compileVersion: 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.















