Exposing the product categories on your site's navigation menu is a good way to organize content as well as offer customers a quicker way to locate products. The Storefront can automatically synchronize your categories injecting them into your page menus.
To use this feature, simply enable the Show categories on page menu
checkbox under the Configuration > Category settings. Once enabled, the Storefront will periodically synchronize your published categories with the page navigation menu every few hours.
Grouping categories under a page menu
If you like to group your categories under a page heading (e.g. "Shop" or "Browse by category"), choose a target page for the Show categories under this page setting. It's important to choose a target page that does not result in circular loop.
Understanding how circular loop happens
The Storefront creates special redirection pages into your site menu. These special pages act like hyperlinks that point to the natural paths in the Product List page organized by their respective categories. It's important that the target page must not be the same page as where the Product List module is located. Doing so will create a circular loop navigation.
To illustrate this problem, suppose you have a "Products" page that is hosting your Product List module and you have a category called "Books". The natural path for the "Books" category would be https://site.com/products/books
If your target page is also set to "Products" page, the Storefront will create a special page "Books" under the "Products" page. At this point, the system is no longer able to differentiate between the natural category path and the general page navigation path because they both have the same /products/books paths resulting in a circular loop.
How to group categories under all "Products" page.
It's possible to group your categories underneath the all "Products" page menu where the Product List module is hosted. First, you need to configure your "Products" page to be hidden from the menu. Then create another page (e.g. "Shop") that redirects permanently to the "Products" page and visible on the menu. Now you can set the target page to the "Shop" page. On your menu, you will now see "Shop" and underneath that is a list of all your categories. The paths will remain the same as /products/category and will not cause a circular loop.
Categories that are added to the site menu may not be sorted correctly due to limitations in the core system, but should generally respect the overall hierarchy and category structure. You may need to manually adjust the ordering of the pages from the Content > Pages as needed.