Magento 2 product categories
- 6 min read
- Karla Sambolić
Product categories are key to building an effective catalog and user navigation to help customers find the products they want as easily as possible.
The user category structure in the main menu can affect user experience and performance. As a best practice, it is usually best to identify one top category and avoid that there are other categories with the same name. For example, instead of having different categories for “Women” organized in different departments, such as clothing/women, footwear/women, hats/women, it may be more effective to make a parent category “women” and then create subcategories as needed. Be consistent with the category structure and use the same approach for all types of products in your catalog.
Root categories and sub categories
The root category is the main category associated with the unique store view in Magento, so the main menu is based on this basic category for that store.
If you have two websites that use Magento multiple store capabilities and multiple websites, you could create two root categories and menu structures so that each page has a completely different menu.
Sub categories are subcategories of the main category. You can create as many subcategories as you want, there are no limits, but remember that multiple categories slow down the page, so you’ll need to invest time in speed optimization afterwards.
Creating Root category
In admin click on Catalog -> Categories.
On the left side click on “Add root category”.
Type in category name. This name will be assigned to all store views.
If you want to add a product to the catalog, click on “Products in Category” and add the desired products.
Click the “Save” button to save the new category.
Before you add products to your catalog, you should create a basic category structure for your catalog. Each product must be assigned to at least one category.
Categories should be created in advance before adding products to the catalog. It is not recommended to create categories when adding products, although it is possible.
Creating sub category (subcategories)
1. stepIn admin, click on “Products” then on “Categories”.
Click on the category that will be the Parent category to the category that we will create soon.
Initially, there are only two categories: Default and Example.
In this case, the Default category is the root category.
After selecting the Parent category, click on “Add Subcategory”.
Turn on “Enable Category” and “Include in Menu” to make the category visible and to be displayed in the menu.
Under “Category name”, enter the desired category name.
Under Content you can upload a category image and add a category description.
When all this is entered, click Save.
When you click on “Display setting” additional options opens.
Under “Display mode” mark one of the offered (Products only, Static Block only or Static Block and Products). This is useful, for example, if want images to be displayed in the parent category and products in the subcategory, then one category can be Static Blog only and the other will be Products only.
Turn on “Anchor” if you want the category page to display “Filter by Attribute”, for example: size, price, color, etc.
Under “Search Engine Optimization” enter URL Key, Meta title, Meta keywords and Meta description for new category.
A meta title is the title that appears above the page URL in search results. This is very important for SEO and should have about 70 characters or less.
A meta description is a description that appears below your URL in search results and should be 150 characters or fewer.
If you already have products that are made, you can add them to this new category, cancel them or select their location. As we said earlier, categories should be created in advance before adding products to the catalog.
7. step Design
Use Parent Category Settings – if checked, the category design will follow the parent category design.
Theme – this allows you to select the theme of the category, ie what the category will look like. Each category can have a different theme.
Layout – this allows you to select a layout, such as one column, two columns, etc.
Layout Update XML – here you can add additional functionality to categories via XML.
Save the new category and view it on the frontend.
Working with categories
You can move the categories to another location or you can delete them completely from the catalog and all this in a few very simple steps.
Before making any category changes, consider how those changes may affect existing product links in the category.
For example, if product URL contain a path to a category and you change that category, existing links to products in the category will no longer work.
You can move categories using the drag & drop technique, ie left click on a specific category and then, without releasing the button, drag it to the desired location and release the mouse button to release it. The new order of categories is saved automatically.
Click on the category you want to delete.
When the page reloads, click on the “Delete” button in the upper right corner and confirm the deletion.
It is impossible to restore a deleted category, so be careful when deleting them.
Some users cannot find the “Delete” button in the root category as they can in the subcategory.
As the root category is the highest level of the category, you cannot remove it while it is active or assigned a store. Therefore, if you want to delete a root category, you must first check its status.
Hiding a category makes the category invisible in the user view and navigation menu while it is linked to other places in your web shop.
The hidden category will perfect the internal purpose or any request of the admin.
You can hide a category like this way:
Click on Admin-> Catalog->Categories-> and on the left side click on the desired category.
After the page reloads, turn off “Enable Category” and “Include in menu” and under “Display settings” turn off “Anchor”.
Despite the fact that the category is hidden, you are allowed to add subcategories. To enable this, activate “Enable Category” and under “Display settings” activate “Anchor”.
Now the hidden category can be linked to other places on your web shop, but it is not visible in the navigation menu.
Click “Save” to save the new category settings.
Adding a root category to a specific store
In admin click on Stores->Setting->All Stores.
In the “Stores” column, click the store to which you want to assign a new catalog.
Under “Root category”, place the new root category you created.
Then click “Save Store” to save the settings.
To confirm that the store has a new catalog, click Catalog->Products.
All products copied to the new catalog will be visible.
Visit the web shop and check that the new catalog and main menu are working properly.
Importing products into a specific category through CSVTo avoid problems when importing products, it is important to start the process with a well-formatted CSV file (comma separated values).
1. option – Manually create your CSV file
Before you start working on your CSV file, make sure the file is formatted correctly for Magento:
- Your CSV must be in UTF-8 format
- columns (Separator) must be separated by a tab and a comma
- when saving the file, save it as .csv, not as .xls
You can retrieve this sample file from admin by clicking System-> Import.
Under “Entity Type”, select “Products” and the “Download Sample File” link which will appear on the right.
This example will provide you with a complete list of all available product attributes. Of course, you don’t need all attributes. Use only the ones you need.
We recommend that you always use this second option when importing.
After downloading the sample file, open it and edit it with your products.
In the “Categories” column, enter the path to the category to which the product you want to import belongs.
In our example it is Default Category / Gear, Default Category / Gear / Fitness Equipment.
If the product belongs into more categories, as in our example where it belongs into two categories, you must separate those categories with a comma.
Categories must be created according to the specified hierarchy, for example, if you have a value for the field Categories: All products / First Category / Second Category, then Magento will first create an All products category and then subcategory First Category and after that Second Category which will be subcategory for First Category category.
If all the entered categories already exist, then the product will simply be added to those categories without creating new categories.
Save the CSV file and in the admin click on System -> Import.
Under “Entity Type”, select “Products”.
Under “Import Behavior”, select “Add / Update”.
Import Behavior has several product import options:
- with the already mentioned “Add / Update” Magento checks the availability of products with the specified SKU. If a match with the SKU is not detected, then new values are added to the product, and in case such a product does not exist, Magento creates it.
- Replace – the value of product attributes is replaced with new ones.
- Delete – if there is a product with a specific SKU in the file, the product is deleted from Magento.
Magento implements several error handling algorithms. When you use the “Stop on Error” option, any error when checking the file will not allow the import to start.
By default, Magento uses a comma to separate values in a CSV file, but you can use another separator that you used to create or edit the import file. It is recommended that you always use a comma to separate values.
To prevent incorrect data import, such as equals, more and less characters, single and double quotes, backslashes, spaces, and reinforcements, turn on Fields enclosure. This way Magento will add additional double quotes to prevent the import of special symbols.
Under “Select File to import”, select the CSV file you want to import.
If you also want to import images with products, import all images into var / vendor / images first through Cpanel. For all images, Permission must be set to 775.
You do not have to enter this path in the “Image File Directory” because it is by default in Magento. You don’t even have to type in a CSV file, you just need to enter the correct image name and image format (example.png). When you have entered everything, click on “Check data” to check if everything is OK with the file you want to import. If everything is fine and there are no errors displayed, click “Import”. After a few seconds (depending on the amount of products being imported), a message will appear stating that the import was completed successfully.
Adding and deleting products from / to categories
Deleting or adding a specific product from a category can also be done from the Magento admin.
There are two options for performing this task.
1. option – via the category menu
In admin, click on Catalog -> Categories.
On the left, click on the category to which you want to add an already saved product.
When the page reloads, click on “Products in Category”.
You will be shown a list of all products that are already in the category.
The first column check box can be used to select or deselect all products.
The field in the first row can be used to filter the products in your store: ID, Name, SKU, Price.
In the first field of this line you have 3 options: Any, Yes, No. “Any” means that all products will be displayed, “Yes” means that they are in the category, and “No” means that they are not in the category.
Find the desired product using the filter. After setting the value in the filter field, click on “Search” to display the product results.
Deleting products from the category:
When a list of products that are already in your store is displayed, clear the check box before the product you want to remove from the category. If you want to remove all products, click the check box in the header of the first column.
When you have done that, click on the “Save” button.
Adding products to the category:
Use the filters we mentioned to search for the product you want to add.
When the product is displayed, simply check the box next to the product and click the “Save” button.
2. option – via the Products menu
Use the filter to find the desired product and click on it. When the desired product opens, under “Categories” select a category or click on “New Category”.
Why categories don’t show up?
If the categories are not active, they will not be displayed. To solve this in admin, click on Catalog -> Categories, select the desired category and turn on “Enable Category”.
The category may be inactive because its parent category is disabled. In this case, your category will still be available via the direct link, but will be unavailable in the category list and in the menu.
Categories are very useful for online commerce from every perspective because they arrange products properly, serve as a great navigation tool, and are great for search engine optimization (SEO).
The main principle of category management is to maintain a hierarchy of categories and subcategories.
As you can see, category management is a fairly simple task.
If you have any additional questions or need to create a Magento store, feel free to contact us.
How Content Marketing Works
If you are an owner of a business and want to stand out from the competition, content marketing is something you should really put your efforts in. As we all know, traditional marketing strategies are becoming less effective on a daily basis. That is because the world has basically moved online, so marketing had to…
Magento 2 product categories
Product categories are key to building an effective catalog and user navigation to help customers find the products they want as easily as possible.The user category structure in the main menu can affect user experience and performance. As a best practice, it is usually best to identify one top category and avoid that there are…
SEO Link building
When it comes to SEO, there are numerous things you can do to improve your ranking on search engines. One of the most important parts of SEO – and simultaneously one of the hardest – is SEO Link building. You want to create a network of links on other sites (backlinks) that lead back to…
What to do if you end up on the Yandex Blacklist
Yandex is a russian international corporation specializing in internet services and products. It is incorporated in the Netherlands and primary used by the public in Russia. Yandex is ranked as the 4th largest search engine in the world. Yandex’s main competitors on the Russian market are Google, Mail.ru, and Rambler.Yandex Safe BrowsingYandex Safe Browsing verifies…