How to remove the navigation from the product pages only

Highlighted
New Member
3 0 0

I'm new to Shopify and it's structure and I'm sure there is a way to do this, however, I can not find any specific documentation on it. I would like to show the navigation for the store on every page except for the product pages. This would be an example of the type of page I would like to hide navigation on.

https://teepedia.myshopify.com/collections/frontpage/products/all-i-care-about-pp-95-shirt?variant=8...

Does anyone know how this is accomplished or at least have an idea. I thought it would have something to do with removing the elements from my product.liquid in the Templates but it looks like it's not set up the way that I thought. Even if someone could point me in the right direction that would be extremely helpful. Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
329 0 35

Hi Jesse,

The best way to do this would be to copy how the theme.liquid looks for Minimal. In this theme (and many others for sure!) there is a line at the top that reads:

{% if template == "404" %} Page not found{% elsif template == 'index' %}{{ shop.name }} {% endif %}

This way you can check if the template == 404 or index, or contains something, liquid has operators for the common logic operations.

The next part would be to find where the navigation is and wrap it in the if statement.

Roughly: If template == "collection"

*don't put anything for the navigation here*

else

*all the navigation code that is already in your theme goes here*

endif

Does this help point you in the right direction? I'd also suggest getting a few free themes and digging into the first few lines of the theme.liquid to get a feel for how these templates can be adjusted.

Highlighted
New Member
3 0 0

That points me in the right direction I think. Thank you.

Now I can start to mess around with the theme I have and make something work. Don't be surprised though if I end up back on this thread :)

0 Likes
Highlighted
Shopify Staff
Shopify Staff
329 0 35

Great, well have fun!

Another tip to keep in mind is to duplicate the theme once you have a nice result you want to keep.

You can also view previous versions in the same theme if you need to "undo" some code changes and forgot how it once was. One thing to note: once you duplicate the theme only new updates are saved in the versions, not the ones for the previous copy.

0 Likes
Highlighted
New Member
3 0 0

AH HA! It's perfect now, thanks again Massaad!

0 Likes
Highlighted
New Member
3 0 0

Re: How to remove the navigation from the cart and checkout pages only

 

theme is symmetry

millbee.com/cart

0 Likes