Skip to main content

Command line interface

Automatic Related Products provides a command line interface (CLI) for managing and maintaining extension-related data. This is useful when troubleshooting indexing issues, cleaning up outdated relations, or ensuring product recommendations are always up to date.

Available commands​

php -f bin/magento indexer:reindex mst_related_index

What it does: Rebuilds the index of all Automatic Related Products rules and relations. Use this after:

  • Creating or updating product recommendation rules
  • Changing product attributes used in rule conditions
  • Experiencing missing or outdated related products on the storefront

php -f bin/magento mirasvit:related:cleanup

What it does: Removes the Magento layout updates (layout XML) that this extension's product blocks registered. It does not touch product relations, the index, or analytics data. Run this command before disabling or uninstalling the extension - otherwise Magento may error when trying to render layout blocks that reference a disabled module.


php -f bin/magento mirasvit:related:restore

What it does: Re-saves every existing product block, which regenerates the layout updates removed by mirasvit:related:cleanup. Run this command after re-enabling the extension (e.g., bin/magento module:enable Mirasvit_Related) to restore its blocks' layout registrations.