Categories in Magento is one of the ways to improve navigation, group products with different attributes, and help customers find products they are interested in faster.
Magento provides comprehensive options to create categories. But it is a long and time-consuming process since after you create categories, you need to add products to them manually.
Much faster will be to create categories and subcategories dynamically based on product attributes pattern and add products to them according to certain conditions.
Seems too easy?
Well, it is easy with the Dynamic Categories Extension for Magento.
Today, you'll create a dynamic category by the pattern with 17 subcategories just in a few clicks.
To create categories in Magento 2 dynamically by pattern:
1. Go to Catalog > Dynamic Category > Rules and press the Add New Rule button.
2. Enable the Rule, enter a Description, set Priority and choose Pattern as Categories Type.
3. Select the Parent Category and the Pattern which you create the subcategories by.
It is the most interesting part, so let's get a closer view of how this works. There are 2 possible scenarios here:
If you specify the product attribute in double brace separate by a slash (/), you will get subcategories.
e.g. Pattern: ❴❴brand❵❵/❴❴model❵❵/❴❴version❵❵
where ❴❴brand❵❵ — Apple, ❴❴model❵❵ — Iphone and ❴❴version❵❵ — 12.
As a result, you will get Parent Category > Apple > Iphone >12 structure.
The second option is creating a single subcategory.
e.g. Pattern: T-shirt with ❴❴material❵❵ - color ❴❴color❵❵
where ❴❴material❵❵ — cotton or viscose, ❴❴color❵❵ — red or blue.
This will result in the following pattern T-shirt with cotton - color red or T-shirt with viscose - color blue.
To check how your categories will be structured and how many categories will be created press the Preview Categories button. It allows you to edit the pattern and adjust the attribute values to get the expected result.
4. Select the Websites and a method to Apply the rule By.
5. Choose whether you want to
6. Keep the
8. Set up Product Conditions under which products will be added to your categories created by pattern.
If you already specified to add products with the same attribute as in the category pattern name (
Once you finish, don't forget to Save or Save and Apply the rule if you want to see the categories immediately.
Note: creating categories dynamically in Magento doesn't cover other category options e.g. Search Engine Optimization, Design, Display Settings. You need to finish up category confirmation separately. Learn more about other category options in this guide on how to create categories in Magento.
However, after you save the dynamic category created by pattern, it will appear on the storefront.
Several options, a few minutes, and you create 17 new categories with products added there by pattern.
Could creating categories in Magento be any faster?
Magento 2 Dynamic Categories Extension makes it much faster and more convenient. So, you can not only add products to categories by condition but even create categories and add products to them in bulk.
If you want to see how it all works, check the dynamic categories demo and create your own pattern for categories.