Top navigation

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.

Top Navigation {width="700" modal="regular"}

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. Generally, using between one and three visible levels is 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

Item
Description
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

  1. On the Admin sidebar, go to Catalog > Categories.

  2. Set a Store View to determine where the new category is to be available.

  3. 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.

  4. Click Add Subcategory.

  5. Complete the basic information with following settings:

    • Enable Category set to Yes
    • Include in Menu set to Yes
  6. In Display Setting set Anchor to Yes.

  7. Complete any other required category settings.

  8. When complete, click Save.

For a multistore installation, a different main menu can be assigned as the root category for each store.

Step 2: Set the depth of the top navigation

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel, expand Catalog and choose Catalog underneath.

  3. Expand the Category Top Navigation section.

    Category Top Navigation {width="600" modal="regular"}

    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.

    For a detailed list of these options, see Category Top Navigation in the Configuration Reference.

  4. To limit the number of subcategories that appear in the top navigation, enter the number for Maximal Depth.

    The default value is 0, which does not place a limit on the number of subcategory levels.

  5. When complete, click Save Config.

recommendation-more-help
af062d56-f22c-4537-813d-bedf8b92a071