How to add collection metafield image file to header

Hello,

I want to add image file in header like this image.

[ what I want ]

However, I don’t know how to get the collection metafield file data to header. I tried this code, but It said “no image”. Is there a way to get the collection metafield to header?

[ the collection metafield file ]

[ code ]

{%- if link.links != blank or small_promo_count > 0 -%}
                    
                      

                        {% if use_columns and link.levels == 1 %}
                          - {% for child_link in link.links %}
                              
                                  {{- child_link.title | escape -}}
                              
                              {% endfor %}
                          

                        {% else %}
                          {% for child_link in link.links %}
                            - {{- child_link.title | escape -}}
                              
                                {% if child_link.links != blank %}
                                  {% render 'icon-toggle-menu', stroke_width: 1.3 %}
                                {% endif %}

                                {% if child_link.links != blank %}
                                

                                  

                                      {% for child_child_link in child_link.links %}

                                      - {{ collection.metafields.custom.menuthumnail | img_tag }}

                                      - {{ child_child_link.title | escape }}
                                    
                                      {% endfor %}
                                  
                                

                                {% endif %}
                            
                          {% endfor %}
                        {% endif %}

[ result ]

I don’t reply get your issues, can you be more specific

1 Like

I want to make mega menu that include collection’s photo and title to show how our chairs look like even though they don’t click menu. Thus, I added the collection metafields data as file, and tried to show it in Global Navigation bar.

However, it failed. I typed like this, but it couldn’t get the image file.

- {{ collection.metafields.custom.menuthumnail | img_tag }}

[result: no image]

I followed this blog post.
blog post: https://www.identixweb.com/shopify-collection-metafields/#