upturnstudio / module-smart-categories
Smart categories for Magento 2 — rule-driven category membership, recomputed on save via message queue and cron.
Package info
github.com/brideo/module-smart-categories
Type:magento2-module
pkg:composer/upturnstudio/module-smart-categories
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
- magento/framework: *
- magento/module-catalog: *
- magento/module-catalog-widget: *
- magento/module-eav: *
- magento/module-page-builder: *
- magento/module-rule: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Rule-driven categories for Magento 2.
Flag a category as smart, describe its products with a rule such as Price greater than 100 AND Color is Blue, and the module keeps the category's product list in line with that rule. Products are added when they start to match and removed when they stop.
What it does
- Adds a Smart Rules section to the category form in admin, with the same condition builder used by the Products List widget.
- Assigns matching products to the category and removes the rest. Products added by hand to a smart category are removed unless they match the rule.
- Updates in the background. Saving a category or product queues the work, so saves stay fast.
- Runs a full check of every smart category each night, to catch changes made by imports or bulk updates.
- Provides a command to recompute on demand.
Categories that are not smart are never touched. A smart category with no conditions is emptied, not filled with the whole catalogue.
Requirements
- Magento 2 (tested on PHP 8.4)
Magento_PageBuilderenabled- Cron running
Installation
Composer
composer require upturnstudio/module-smart-categories bin/magento module:enable UpturnStudio_SmartCategories bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Manual
Copy the module to app/code/UpturnStudio/SmartCategories, then run:
bin/magento module:enable UpturnStudio_SmartCategories bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Usage
- Go to Catalog → Categories and open a category.
- Open Smart Rules and switch Enable smart rules on.
- Click +, choose an attribute, then set the operator and value. Use ALL or ANY to combine several conditions.
- Save.
The category updates once the queue has run. With cron running this happens on its own. To apply a rule straight away:
# One category bin/magento upturnstudio:smart-categories:recompute --category-id=42 # Every smart category bin/magento upturnstudio:smart-categories:recompute
Configuration
Stores → Configuration → UpturnStudio → Smart Categories
| Setting | Default | Purpose |
|---|---|---|
| Enable Recompute | Yes | Master switch for updates on save, from the queue and from the nightly run. |
| Cron Schedule | 0 3 * * * |
When the nightly full check runs. |
Known limitations
- ANY rules can miss products. A product with no value for one of the attributes in an ANY rule is left out, even when it matches another condition. ALL rules are not affected.
- Hidden and disabled products are assigned. Products set to "Not Visible Individually" can match a rule, so the product count in admin can be higher than on the storefront.
- Default store values only. Rules ignore store view overrides.
- Storefront can lag behind admin. When indexers are set to "Update by Schedule", the storefront changes on the next indexer cron run.
Support
Manual test cases and the latest results are in
docs/qa-test-results.md.