---
title: 'Automatic Related Products'
url: 'https://info.srv.kowal.co/docs/magento/modules/automatic-related-products'
markdown: 'https://info.srv.kowal.co/docs/magento/modules/automatic-related-products.md'
lang: en
date: '2026-11-29'
description: 'Create a related product rule, choose a block on the product page, category or cart, and apply the rule from Magento Admin or the command line.'
taxonomy:
  category:
    - docs
    - Magento
    - Modules
  tag:
    - related-products
    - merchandising
    - catalog
    - automation
---

# Automatic Related Products

Composer package **`kowal/module-automatic-related-products`** · repository version **1.0.18**

## Product page

A product page on kowal.co has not been confirmed.

## Description

This module adds rule-driven automatic related products for Magento 2. It stores rule results in its own index table and renders them in multiple frontend positions (product, category, cart), with options to merge into or replace native related/upsell blocks.

## For whom

For Magento merchants and teams who want centrally managed, rules-based related product merchandising across multiple storefront positions.

## Features

- Rule management in Admin UI with conditions (products to display) and actions (where/when to display).
- Frontend placement options for product page, category page, cart page, and a custom position list.
- Merge modes: add to native related/upsell collections or replace them.
- Scheduled rule application via cron and manual application via Admin button and CLI command.
- Declarative schema with dedicated tables for rules, rule-store links, and computed related product IDs.
- Cache tag invalidation for affected products after rule reindex.
- Optional Hyva template switch (Hyva/default theme) and template selection per rule.

## Installation

From the Magento root with Composer access to the package, run:

```sh
composer require kowal/module-automatic-related-products
bin/magento module:enable Kowal_AutomaticRelatedProducts
bin/magento setup:upgrade
bin/magento cache:clean
```

## Configuration

- Admin path: Stores > Configuration > Kowal > Automatic Related Products.
- Config path: `automaticrelatedproducts/general/enabled`.
- Scope: config is read on store scope, but the Admin field is only editable at Default scope (Show in Default = 1, Website = 0, Store View = 0).
- Admin rules: Automatic Related Products > Rules (admin route `automaticrelatedproducts/rule/*`).
- ACL: `Kowal_AutomaticRelatedProducts::config` for configuration and `Kowal_AutomaticRelatedProducts::rule` for rules.

### Deployment And Operations

- Apply rules on demand in Admin via the “Apply Rules” button or via CLI `kowal:arp:apply` (optional `--ids` with comma-separated rule IDs).
- Cron job `kowal_auto_related_product_cron_update_related_products` runs every 8 hours at minute 20 in the `default` cron group.
- The module updates the `kowal_automaticrelatedproducts_index` table and dispatches `clean_cache_by_tags` for affected product cache tags.

## Requirements / notes

- Composer dependency: `kowal/base`.
- Magento modules used in code: Catalog, CatalogRule, SalesRule, Ui, Backend, Store, Cron, CatalogInventory, Checkout.
- TargetRule is referenced in DI (`Magento\TargetRule\Block\Catalog\Product\ProductList\Related`), which is available in Adobe Commerce; ensure compatibility if on Open Source.
- Optional integration: `Kowal_DynamicProductAttributes` (adds custom validation filters) and `Kowal_AutomaticRelatedProductsExtra` (extra templates).
- Database tables: `kowal_automaticrelatedproducts_rule`, `kowal_automaticrelatedproducts_rule_store`, `kowal_automaticrelatedproducts_index`.

### Compatibility

- Module version in `composer.json`: 1.0.18, `setup_version` in `etc/module.xml`: 1.0.16.
- No Magento version matrix is specified in the repository.

### Deployment Checklist

- Verify `Kowal_AutomaticRelatedProducts` is enabled and config flag is turned on.
- Create at least one rule with conditions and a target position.
- Apply rules once (Admin button or CLI) and confirm index table population.
- Confirm cron is running to keep index data up to date.
- Validate frontend placement on product/category/cart pages for the chosen positions.

### CI/CD And Environments

- Ensure database schema is applied on deploy (declarative schema).
- Deploy static content for admin UI JS and frontend templates when needed.
- If you use Hyva, verify the Hyva template switch behavior.

### Rollback

- Disable the module and remove it from Composer, then run Magento setup to remove schema changes if your deployment process supports module removal.
- Clear caches after disabling to avoid stale related products blocks.

## FAQ

- Which Magento versions are supported? Not specified in the codebase or README.
- Are fields like start/end date, customer groups, and display mode toggles enforced? No implementation found in backend logic beyond UI storage/serialization.

**How do I refresh the results after editing a rule?**

Use **Apply Rules** or run `bin/magento kowal:arp:apply --ids=ID`, replacing ID with the rule ID. The module writes the calculated relationships to its own index table.

## Verify the installation

```sh
bin/magento module:status Kowal_AutomaticRelatedProducts
```

After reindexing the rule, open a matching product. Check the block position and compare the displayed products with the rule actions.

---

## Navigation

- Parent: [Magento 2 Extensions](https://info.srv.kowal.co/docs/magento/modules.md)
- Previous: [Applied Rules](https://info.srv.kowal.co/docs/magento/modules/kowal-applied-rules.md)
- Next: [Kowal_CheckoutComment](https://info.srv.kowal.co/docs/magento/modules/checkout-comment.md)
