The main menu of your store is like a directory to the different departments in your store. Each option represents a different category of products. The position and presentation of the top navigation might vary by theme, but the way it works is essentially the same.
The category structure of your catalog can influence how well your site is indexed by search engines. The more deeply nested a category, the less likely it is to be thoroughly indexed. As a general rule, anywhere between one and three visible levels is considered to be the most effective. The root category counts as the first level, although it doesn’t appear in the menu. The maximum number of levels that are available in the top navigation is determined by the configuration. In addition, there might be a limit to the number of menu levels that are supported by your store theme. For example, the sample Luma theme supports up to five levels, including the root.
Counting menu levels
|Level 1||The first level is the root category, which in the sample data is named “Default Category.” The root is a container for the menu, and its name does not appear as an option in the menu.|
|Level 2||On a desktop display, the top navigation is the main menu that appears across the top of the page. On a mobile device, the main menu typically appears as a fly-out menu of options. The second-level options in the Luma store are What’s New, Women, Men, Gear, Training, and Sale.|
|Level 3||The third-level appears below each main menu option. For example, under Women, the third-level options are Tops and Bottoms.|
|Level 4||The fourth-level options are subcategories that fly out from a third-level option. For example, under Tops, the fourth level menu options are Jackets, Hoodies & Sweatshirts, Tees, and Bras & Tanks.|
Set the top navigation
For a category to appear in the top navigation of a store, complete the following steps:
Step 1: Create a category
On the Admin sidebar, go to Catalog > Categories.
Set a Store View to determine where the new category is to be available.
In the category tree, select the parent category of the new category.
If you’re starting from the beginning without any data, there might be only two categories in the list: Default Category, which is the root, and an Example category.
Click Add Subcategory.
Complete the basic information with following settings:
- Enable Category set to
- Include in Menu set to
- Enable Category set to
In Display Setting set Anchor to
Complete any other required category settings.
When complete, click Save.
Step 2: Set the depth of the top navigation
On the Admin sidebar, go to Stores > Settings > Configuration.
In the left panel, expand Catalog and choose Catalog underneath.
Expand the Category Top Navigation section.
Because the depth of the top navigation has a global configuration scope, the setting applies to all websites, stores, and store views in the Commerce installation. The Category Top Navigation configuration section is available only when Store View in the upper-left corner is set to “Default Config”.
To limit the number of subcategories that appear in the top navigation, enter the number in the Maximal Depth field.
The default value is
0, which does not place a limit on the number of subcategory levels.
When complete, click Save Config.