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 outdated, duplicate, or unnecessary related products data from the database. Use this command if:

  • Old relations remain after changing or deleting rules
  • Database grows with unused recommendation entries
  • You want to keep the extension’s data storage optimized and clean

Here’s a customer-friendly description for the restore command in the same style as your cleanup example:


php -f bin/magento mirasvit:related:restore

What it does: Restores previously generated related products data into the database. This command is useful when you need to quickly rebuild recommendation data without reprocessing all selection rules from scratch.

Use this command if:

  • You accidentally cleared related products data (e.g., after running cleanup)
  • You want to reapply cached recommendation results
  • You need to restore the previous state of related product blocks for testing or validation