Category pages divide your store’s inventory into manageable groups. This makes it easy for customers to navigate and shop.
Our tutorial will familiarize you with the product category hierarchy and show you how to create the root category and its subcategories in Magento 2. We’re using Magento 2.4.1, but these steps are the same for all Magento 2 versions.
Product Category Hierarchy in Magento 2
The category structure of a Magento catalog resembles an inverted tree, with the root at the top. The root expands into branches called the parent categories, further expanding into child categories.
In the following image, “Default Category” is the root category, and the rest of the categories, such as “What’s New” and “Women,” are the parent categories. Categories such as “Collection” and “Promotions” are grayed out because they are hidden or disabled.
Here’s an overview of the product category hierarchy of a Magento store below:
A root category is a menu container with categories and subcategories. It stands at the top of the category hierarchy.
Magento has a Default Category, which is the root. This root category does not appear on the website menu and does not have a URL.
You can create a new root category with a new set of products or duplicate products from the existing root category. If you have a website with multiple stores, you can create and assign a new root category for each store.
Note that there can only be one active root category per store.
Category, or parent category, is the category that appears under the root category. It displays at the top of the menu categories panel on the frontend and has a URL.
In Magento, all structural elements nested below the Root category are called Subcategories. So a parent category is called a subcategory, and so is a child category.
A subcategory is a division of the parent category and is also known as a child category. They help you group products based on matching attributes.
On the storefront, subcategories appear when you hover on a parent category, and they also have a URL.
How to Create Categories in Magento 2
- Go to Catalog > Categories in the Magento admin sidebar.
- Assign the category to All Store Views or choose a specific “Store View” by expanding the dropdown on the top left.
- Add a root category or a subcategory in this step by navigating to the category tree located on the left side.
Magento has a premade root category called the “Default Category.” You can directly start adding parent and child categories under the “Default Category.” If you want to create a new root category, click on the Add Root Category button and proceed to the next step.
To create a parent category, click on the root category first and then the Add Subcategory button. Similarly, you can create a child category by clicking on the parent category first and then clicking the Add Subcategory button.
- On the “New Category” page, set the Enable Category option to Yes if you want the new category to be available immediately on the frontend.
- Set Include in Menu to Yes if you want the new category to appear in the top navigation, which is the main menu of your store.
- Insert the name of the new category in the Category Name text area.
- Click the orange Save button located on the top right. You’ll now see the new category in the category tree.
- Expand the Content section and add the following details:
Category Image: Add a category image by either uploading your image or selecting an image that exists in the Media Storage. This image appears at the top of the “Category” page.
Description: Add content that best describes the category.
Add CMS Block: Insert a static block on the “Category” page by selecting a CMS Block from the dropdown list. Then, click on Save again and proceed to the next step.
- Expand the Category Permissions section and set the following permissions:
Note that this section is available in Adobe Commerce only. Skip this part and proceed to the next step if you’re using Magento Open Source.
Click on the New Permission button to create a new permissions rule.
Add the appropriate Website if you have a multi-site installation.
Select the applicable Customer Group where the permissions apply.
Set permissions for Browsing Category, Display Product Prices, and Add to Cart.
Click Save and continue to the “Display Settings” below.
- Expand the Display Setting section and configure the following settings:
Display Mode: Set the display mode to either option 一 Products only, Static block only, or Static block and products.
Anchor: Enable “Anchor” to Yes if you wish to include the “Filter by Attribute” section in the Layered Navigation.
Available Product Listing Sort By: To change the “Available Product Listing Sort By,” unselect the Use All checkbox and choose Product, Product Name, or Price.
Default Product Listing Sort By: To change the “Default Product Listing Sort By,” unselect the Use Config Settings checkbox and choose Product, Product Name, or Price.
Layered Navigation Price Step: To change the “Layered Navigation Price Step,” unselect the Use Config Settings checkbox and insert an incremental price value.
Click Save to proceed.
- Expand the Search Engine Optimization section and add the following details:
URL: Enter a search engine-friendly URL that’s not too long and has the category name.
Meta Title: Enter a unique title of fewer than 70 characters to indicate the category topic. It will appear in the title bar, browser tab, and SERP.
Meta Keywords: Insert all the keywords relevant to the category and products that potential customers may use to find the products.
Meta Description: Enter a compelling description that’s less than 155 characters. It will appear as a brief introduction in search engine results.
- Expand the Products in Category section and add products manually by selecting the corresponding checkboxes.
You can also use the Search Filters at the top of each column to find the products.
To display products that haven’t been added to the category yet, change Any in the first column dropdown to No and hit the Search button.
Click on Save and continue.
- Expand the Design section and configure the following settings:
Use Parent Category Settings: Enable it to Yes if you want to apply the parent category design settings to the new category.
Theme: Select the theme from the dropdown list to apply the theme design to the category pages.
Layout: Choose 1 out of the 5 layout options from the dropdown to apply the layout design to the category pages.
Custom Layout Update: You’ll see No Update in the dropdown unless you’ve created a custom layout update file and placed it in the module or theme folder.
Note: the “Layout Update XML” field has been removed in the 2.3.4 and above versions and replaced with the “Custom Layout Update.”
Apply Design to Products: Set “Apply Design to Products” to Yes if you want to apply the same design on product pages.
- Schedule a design update in the Schedule Design Update section using the From and To dates in the calendar.
- Click Save on the top right.
That’s it! You’ve successfully created a category in Magento 2.