How to assign a different header menu to a single page or a Collection Shopify Dawn theme 15.2.0.

I’ve searched the net quite a bit.

I And done quite a few test codes.

But to no avail nothing’s working quite right.

I’m looking for the code necessary to assign a different header menu to a single page or a Collection in the Shopify Dawn theme 15.2.0.

This file template collection has been made and handle is “sogoodsisters”.

This file template page has been made and handle is “so_good_sisters_pagetemp”.

This menu has been made and handle is “2550105_sgs_menu”.

One menu for all other pages.

(This menu has been made and the handle is “241228_n_menu”)

If you could advise or any insight, I’d be greatly appreciated.

@JEA_visq - this will be a coding task,

1] you need to go to header file

2] find code for header menu

3] before this menu code , check collection handle to find if the collection has handle above

4] if yes then put code for your new menu

5] else old menu code

Hello @JEA_visq Your task is possible, but it will take some time because its coding is quite lengthy. Each page has a separate CSS, and based on that, two headers are created. If you find it appropriate, send me the URL in the inbox. I can check the store and let you know how much work needs to be done.
Thank you!

Hi @JEA_visq ,

Please go to Actions > Edit code > snippets > header-dropdown-menu.liquid file, and add change all code:

{% comment %}
  Renders a standard dropdown style menu for the header.

  Usage:
  {% render 'header-dropdown-menu' %}
{% endcomment %}
{%- liquid
  assign menu = section.settings.menu
  if collection.handle == 'sogoodsisters' or page.handle == 'so_good_sisters_pagetemp'
    assign menu = linklists['241228_n_menu']
  endif
-%}

hi @namphan

Sorry for my late reply.

Thank you very much for taking time to answering my request.

And also anyone else who replied to my post.

I think I should be working with the header-drawer.liquid file?

And in that file, I tried some of your code:

{%- liquid
  assign menu = section.settings.menu
  if collection.handle == 'sogoodsisters' or page.handle == 'so_good_sisters_pagetemp'
    assign menu = linklists['241228_n_menu']
  endif
-%}

I’ve also tried a few different versions of this.

Basically, it just shows the original drawer main menu. On all pages.

Haven’t seem to find the right tag or code to assign a different header menu to a single page or a Collection Shopify Dawn theme 15.2.0

Please, if anyone has time. Please see the code below the better-drawer.liquid file.

I feel like I’m pretty close, but just not there yet.

Once again, thank you for advise or any insight is greatly appreciated.

{% comment %}
  Renders a header drawer menu for mobile and desktop.

  Usage:
  {% render 'header-drawer' %}
{% endcomment %}

Hi @JEA_visq ,

Please change:

linklists[current_menu]

=>

current_menu

hi @namphan

Sorry for my late reply.

Thank you very much for taking time to look at this.

Yes, I was thinking something similar. And I tried that.

It wasn’t working. I still get them menu for all pages.

Once again, thank you very much for spending time and making this!

Hi @JEA_visq ,

If you want, I will send you a collaborator invitation and check it again