Skip to main content
Read Shopify’s navigation menus as an app-agnostic tree: routes, handles, images, external links and optional mega-menu columns. Menus are public Storefront data — no customer session required.

One menu

menu is the normalized Shopify menu (raw tags, resource ids). nodes is the UI-ready tree (NavigationNode[]). Mapping happens on render, so it costs no extra request.

Several menus in one request

The Storefront API has a single menu(handle:) root and no menus(...) batch field. useMenus still makes one round trip by generating GraphQL aliases for the requested handles.

Prefetch before navigating

useMenu('main-menu') then renders from the same cache with no spinner.
route is always a plain path (/products/<handle>, /collections/<handle>, /collections/all, /pages/<handle>, /blogs/<blog>/<article>, /policies/<handle>, /search, /account) or the original URL for external/unknown links. Map it onto your own navigator — the SDK never hard-codes a myapp:// scheme. Shopify returns absolute storefront URLs (https://shop.myshopify.com/products/tee). Those are recognized as internal resources, not external links; isExternal is reserved for off-store URLs whose path the SDK cannot route.

Mega menus

A node is a mega menu when children.length >= 6, or when you opt in with an override. columns is then provided:
  • if any child has its own children, each child becomes a column header followed by its descendants;
  • otherwise children are chunked into columns of 4.
Overrides are keyed by item id or url and support title, icon, badge, image, theme, isMegaMenu.

Tree helpers

All are pure and exported (buildNavigationTree, normalizeMenu, parseMenuUrl as well), so tests and custom navigators can reuse them.

Service API

An unknown handle resolves to null; an empty handle makes no request.