remove header / footer on many (collection) pages

remove header / footer on many (collection) pages

kbac
Shopify Partner
30 0 7

Hi there,
I have a large amount of (collection) pages that have customized design elements, so the standard header/footer is not needed.
Is there an easy way to exclude the header / footer on those?
F.i., through a specific meta-field in each collection?

Replies 3 (3)

rajweb
Shopify Partner
827 71 157

Hey @kbac ,

Yes! A great way to conditionally exclude the header and footer on specific collection pages is by using a metafield on each collection. Here’s how you can do it:

Steps to Implement:

1. Add a Metafield to Collections:

- In your Shopify admin, go to Settings > Custom Data > Collections.

- Click Add definition, name it something like hide_header_footer.

- Set the type to Boolean (true/false) so you can easily toggle it.

- Save and then assign true to the collections where you want to hide the header/footer.

 

2. Modify Your Shopify Liquid Theme Code:

- In your collection.liquid (or main-collection.liquid if you're using Shopify 2.0), wrap your header and footer with a condition like this:

 

{% if collection.metafields.custom.hide_header_footer != true %}
  {% render 'header' %}
{% endif %}

<!-- Your collection page content here -->

{% if collection.metafields.custom.hide_header_footer != true %}
  {% render 'footer' %}
{% endif %}

 

3. Alternative Approach (Using Templates):

- If you have significantly different layouts, you could create an alternative collection template (collection.custom.liquid) and assign it manually to collections in the admin.

Would you like help with setting up these metafields programmatically via the Shopify API? Please Feel Free to reach out!

If I was able to help you, please don't forget to Like and mark it as the Solution!

Best Regard,
Rajat

Rajat | Shopify Expert Developer
Need a reliable Shopify developer for your next project?
Our App: Productify Groups App
Email: rajat.shopify@gmail.com
Portfolio: https://rajatweb.dev
kbac
Shopify Partner
30 0 7

Thank you.
I cannot find any file that contains something like render header etc.
There is no collection.liquid (or main-collection.liquid if you're using Shopify 2.0) or similar.

DaisyVo
Shopify Partner
4460 499 594

HI @kbac 

 

Could you share the store link with me?

Also, which pages do you want to hide the header/footer on? Please share 3-4 links so I can check and assist accordingly.

 

Best,

 

Daisy

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Avada SEO & Image Optimizer - The #1 SEO solution