categorization

Categories help you organize your catalog and customers — to find products they are interested in faster. However, the "behind-the-scenes" of category management is not that positive.

You often have to spend hours adding and removing products from categories. Especially when a sale season is approaching. 

But the struggle ends with the solution we're offering you today — Magento 2 Dynamic Category. It helps you completely automatic categories like Brands, Sale, Newly Added, Most Rated, etc. 

So, today you'll learn how to create dynamic categories in Magento and make them work completely autonomously.

1. Fill Out Basic Rule Information

Once you install the extension, navigate to Stores > Configuration > Magefan Extensions > Dynamic Category and enable it.

Then go to Catalog > Dynamic Category > Rules and press the Add New Rule to create a new dynamic category rule. Here you need to: 

  • Enable the rule.
  • Set the Rule Name and add a Description if needed.
  • Specify the Priority which defines how the rule should be processed. The higher the number the later the rule is processed.

new dynamic category magento

2. Define Category Type

Choose Static as a CategoryType if you've already created a category in Magento and Pattern if you want to create categories automatically based on the product attribute pattern. 

In the first case, you need to choose what Categories to add products to.

category settings magento

3. Set Where and How to Apply the Rule

Choose Websites, and specify how to Apply the rule:

  • On Product Save — the rule is applied every time you save a product that falls under rule conditions.
  • Cron — the rule is applied once the cron runs and finds products that meet the rule conditions. The cron runs once a day.
  • Manually — the rule is applied once you press the "Apply Rules" or " Save and Apply" buttons at the top menu.

magento dynamic category application settings

4. Enable Additional Options

Before you define what products to add to the dynamic category in Magento, go through a few additional options:

  • Remove Products from Other Categories — enable this option if you want products generated by the rule to be removed from their original categories (categories they belong to now).
  • Remove Other Products from Category — enable this option if you want all products you've added to a category manually before to be removed (only products generated by the rule will to be added to the category).
  • Use Products from Catalog Price Rules — select catalogue price rules that should initiate adding products to your category (more applicable for the sale categories).

dynamic category settings magento

Note: when you choose to use catalog price rules, make sure they are active and assigned to the guest customer group.

5. Set Dynamic Category Conditions

This is the main part of the Magento dynamic category rule. That's where you set what products to include in a corresponding category(ies).

The conditions are based on the product attributes. 

magento dynamic category product conditions

Note: if you don't see the attribute you want to use for the dynamic category rule you need to add an attribute to the sales conditions.

Additionally, you can set the sorting for the products within the category. Simply select what product attribute to Sort Product In Category By and specify the Direction

sort products in dynamic category magento

Finally, make sure the "right" products are added to the category and preview them. You can edit products directly from here if some don't fit the conditions. 

preview products dynamic category

Once you finish and Save the dynamic category rule you'll see a notification about the rule being successfully created.

It will be applied according to your settings — immediately (Manually) after you press the "Apply Rule" button or by schedule (Cron).

Note: if you have an extensive catalogue and want to apply the rules via CLI to avoid overload, use the following command: bin/magento magefan:dyc:apply-rule.

6. View Rule Conditions Directly on Categories (Optional)

Once you set up the dynamic category rule, you can view it on the category editing page. You can edit a rule right from here if you like.

assign dynamic category rule in magento

Besides, there will be a corresponding message for categories that don't have any rules applied. You can also create a new rule from here.

create dynamic category rule from magento

If you choose to apply product rules on product save and cron, the job is done. No editing or manually applying the rules after.

The extension does all the work for you. You just keep adding or editing products. 

But the benefits don't stop on the regular categories. You can also create the shop by brand in Magento and add brand logos to product pages using our tool.