Hide Cart Icon on Blog and Home Pages - Only show on product and shop pages

Topic summary

A user seeks to hide the cart icon on specific Shopify pages (homepage, blog, news) while keeping it visible on product and shop pages.

Initial Approach:

  • Already using conditional logic to hide the cart on the homepage with {% if template.name == 'index' %}
  • Needs guidance on extending this to other non-shopping pages

Solution Provided:
Add conditional code to the theme.liquid file using multiple template checks:

{% if template == 'index' or template.name == 'blog' or template.name == 'article' %}
<style>.cart-icon{display:none;}</style>
{%- endif -%}

Outcome:

  • The solution was confirmed as working by the original poster
  • Issue resolved
Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

What is the best practice for hiding the cart icon for hompages, news and blog pages and only show it on product and shopping pages? I’m using the following to hide from my homepage but how do I select all non-product and shop pages, is there a not function?

{% if template.name == 'index' %}

{% endif %}
1 Like

@maslerdanch hey, thanks for posting here.
can you please share the link to inspect it, thanks.

https://www.heathkane.co.uk/

Hi @maslerdanch

Please add this code to theme.liquid file

{% if template == 'index' or template.name == 'blog' or template.name == 'article' %}
 
{%- endif -%}
1 Like

Thanks Dan - that’s great!