Shopify themes, liquid, logos, and UX
Hello
I have images connected to my Header Menu with the use of Metafields.
However, some menu items in my header are Direct Links and do not have an image attatched to it.
This automatically makes these menu items show a stock image that says ( No IMG ).
So my problem: I need to Remove these images without removing those i connected to collections and pages with metafields & custom code.
Additionally: If you know a quick and easy way, without apps, to also add images to these URL / Direct Links in my Header Menu Navigation-.. that would be even better.
Thank you in advance!
Solved! Go to the solution
This is an accepted solution.
This was solved outside of this post, Thanks for the help!
Here is what it looks like
Hi @Thomas558
You have to add a control flow. I assume you are using a custom code. You can add an if else statement depending on what metafield type you are using, You can use the code below as reference.
{% if metafield.image != blank $}
Your metafield here
{% endif $}
Thank you for your reply, unfortunately i cant figure out Where and What to code to fix this.
I followed this tutorial to add my Images to the header: https://www.youtube.com/watch?v=wUWo39swCC4
I THINK the place where i need to add this 'control flow' you're talking about is in Header-Menu-Liquid, where i added the following custom code:
{% if section.settings.menu_type_desktop == 'mega' and section.settings.mega_menu_images_toggle != 'none' %}
{% render 'megamenu-image-custom',
link:link,
menu_images_toggle: section.settings.mega_menu_images_toggle,
menu_titles_toggle: section.settings.mega_menu_images_title,
megamenu_backdrop_toggle: section.settings.megamenu_backdrop_toggle
%}
{% else %}
You need to find your metafield code and check if an image us not blank. It might be the file megamenu-image-custom.liquid under Snippet folder
This is an accepted solution.
This was solved outside of this post, Thanks for the help!
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025