How to hide “collections/all” page in Shopify
The “collections/all” page is automatically created by Shopify. This page will show all published products of the Shopify store. For some reason, you may not want visitors to this page. Yes, you can do that.
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, and then click Actions > Edit code.
- In the Templates directory, click collection.liquid.
- Insert below code to the top of this file123{% if collection.handle == 'all' %}<script>window.location.replace("/");</script>{% else %}
- Insert below code to the bottom of this file1{% endif %}
- Click Save and you are done.
Happy coding!
Thank you so much for posting this – it worked!!
In doing this did it affect the child pages from here?
e.g. /collections/bag-straps was still visible?
Basically I’m looking to hide the /collections page for SEO reasons, but don’t want to effect the pages that sit beneath it.
I understand this may not be seen, but if so here is my issue.
I do no have the collection.liquid section
Only a collection.json and that says that the code provided is invalid.
Thanks for any help.
i love u so muc hbroo IT ACTUAYLL FRREAING WORD WHAT RTHEH Ll