When i select the mega menu, it gives me this error “Liquid error (sections/header line 168): Could not find asset snippets/header-mega-menu.liquid”. How do i fix this?
Topic summary
A user encountered a Liquid error when selecting the mega menu option in their Shopify theme. The error indicated a missing file: snippets/header-mega-menu.liquid.
Root Cause:
The user had edited their theme code and accidentally deleted the required file.
Solution Provided:
- Create a new file named
header-mega-menu.liquidin the Snippets folder (Online Store > Themes > Edit code) - Paste the provided code snippet into the new file
- The code includes basic Liquid comment structure for rendering a megamenu
Outcome:
The solution successfully resolved the error. Multiple users offered to investigate further with store access, but the file recreation method worked immediately.
Hi @flaner can you please share your store url?
@flaner Have you edited the theme code because from the error message it seems that the particular file is not present in your theme files?
Yes i did, but then removed it by accident. And i don’t know how to return it.
Okay got it.
Can you please give your store access so that I can fix this issue for you?
How do i do that?
Hi @flaner
You may have accidentally deleted or changed the file name of the header-mega-menu.liquid file. You can create a new header-mega-menu file under Snippets in Online Store > Themes > Edit code and paste this code to that file to solve the issue
{% comment %}
Renders a megamenu for the header.
Usage:
{% render 'header-mega-menu' %}
{% endcomment %}
Hi @flaner
Investigating on the issue deeply will need access of your store as this is an error message due to theme is not having the error file.
Thanks
Hi, it worked thanks! You’re the goat.