Search code examples
shopifyshopify-template

How can I add a specific Shopify menu programmatically?


Say for example, I wanted to add a custom section within the page and I wanted to display a menu in that section.


Solution

  • You can use :

    {% for link in linklists.main-menu.links %}
          <a href="{{ link.url }}">{{ link.title }}</a>
    {% endfor %}
    

    And change main-menu with your handle.

    For example if you create a menu called Custom Navigation, your handle will be custom-navigation

    And you will use :

    {% for link in linklists.custom-navigation.links %}
    

    You can find documentation about linklist object here