Navigation Menus
Menus a merchant builds under Navigation reach a template as linklists, keyed by the menu's handle, the same shape a Shopify theme expects. Declare a menu setting so the merchant can choose which menu a header, footer or section shows.
A menu, live
Hover a top-level link with children to open its dropdown. Open Settings to switch menus or choose none.
Runs in your browser on sample data: the same engine and filters as the storefront. Widgets such as add to cart are simulated: clicking one shows what would happen on a store.
The objects
| Object | Fields |
|---|---|
| linklists["<handle>"] | handle · title · links[] · levels |
| link | title · url · type · active · child_active · levels · links[] (children) · icon · badge · image · description |
activeis true on the current page;child_activewhen one of its descendants is.levelsis 0 for a leaf, 1 with children and 2 with grandchildren: enough for a mega menu.typeuses Shopify's names:collection_link,product_link,blog_link,heading_link,http_linkand so on.icon,badge,imageanddescriptionare extras the merchant sets per item. Use them for a mega menu's images or a “New” pill.
The menu setting
A menu setting stores a handle. Look it up with brackets: {% assign menu = linklists[section.settings.menu_handle] %}. Handles contain hyphens, so linklists.main-menu does not work; use linklists["main-menu"].
Always have a fallback
menu.links.size > 0 and fall back to a few typed links, or nothing, rather than an empty bar.Headers and footers
The theme's header and footer are Liquid too, and are the main users of menus. They appear on every page, so they should read only shop, linklists, settings and their own settings: product and collection are empty on most pages a header is shown on. Use the storefront widgets for the cart and search icons.