This approach works for Dawn to simply display the mega menu for 3-tiered lists and the dropdown for 2-tiered lists.
File to edit: header-mega-menu.liquid
File to reference: header-dropdown-menu.liquid
Enable Mega Menu in the theme. Then edit header-mega-menu.liquid to detect if a parent menu item has grand children. If it does, then display the mega menu code. If the parent menu item has only children, display the code from header-dropdown-menu.liquid.
Example menu where Accessories would use the dropdown menu, while Clothing would use the mega menu.
Accessories
Belts
Watches
Clothing
Shop By Category #
Coats
Dresses
Jackets
Trending Now #
Pants
Shirts
Shoes
What To Wear #
Business
Casual
Night Out
Edit the list item in the links FOR loop: header-mega-menu.liquid
{%- for link in section.settings.menu.links -%}
{% comment %}Check if third-level nav exists on each parent link.{% endcomment %}
{%- assign three_level_nav = false -%}
{% if link.links.size > 0 %}
{% if link.levels == 2 %}
{%- assign three_level_nav = true -%}
{% endif %}
{% endif %}
{% if three_level_nav %}
{% comment %}Use mega menu if nav has grandchildren (3rd) level nav{% endcomment %}
- --- Mega Menu list item code ---
{% else %}
{% comment %}Use dropdown menu if nav has only child (2nd) level nav{% endcomment %}
- --- Copy the list item code from header-dropdown-menu.liquid ---
{% endif %}
{%- endfor -%}
Also, in the mega menu you can set child items (Shop By Category, Trending Now, What To Wear) with just the hashtag # and then hide the link function if a menu item contains the hashtag.
{%- for childlink in link.links -%}
{% if childlink.url contains ‘#’ %}
{% comment %}If the second level nav link is # then remove the tags{% endcomment %}
{{ childlink.title | escape }}
{% else %}
{% comment %}Else display link as usual{% endcomment %}
<a
id=“HeaderMenu-{{ link.handle }}-{{ childlink.handle }}”
href=“{{ childlink.url }}”
class=“mega-menu__link mega-menu__link–level-2 link{% if childlink.current %} mega-menu__link–active{% endif %}”
{% if childlink.current %}
aria-current=“page”
{% endif %}
{{ childlink.title | escape }}
{% endif %}