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

Solved

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

maslerdanch
Tourist
12 0 1

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' %}
<style>
li.menu-cart {
    display: none;
}

  li.search-icon {
    border-right: 0px!important;
}
</style>
{% endif %}

 

Accepted Solution (1)

Dan-From-Ryviu
Shopify Partner
11721 2297 2478

This is an accepted solution.

Hi @maslerdanch 

Please add this code to theme.liquid file

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

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Amazon Products Importer - Import Amazon Products to Dropship in Your Store!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

View solution in original post

Replies 4 (4)

ProtoMan44
Shopify Partner
743 60 114

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

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!
maslerdanch
Tourist
12 0 1

Dan-From-Ryviu
Shopify Partner
11721 2297 2478

This is an accepted solution.

Hi @maslerdanch 

Please add this code to theme.liquid file

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

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Amazon Products Importer - Import Amazon Products to Dropship in Your Store!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

maslerdanch
Tourist
12 0 1

Thanks Dan - that's great!