Redirect Search Result Pages with Zero Results

When visitors search on your site and get zero results, it's not the best experience. You sometimes want to redirect to a more relevant page instead of just saying "sorry, there are no results". This page can be a similar result to what they searched for, a replacement or a substitute product.


This tutorial code will show you how to achieve this. It requires a little bit of copy and paste in your Shopify backend. To make it work, it should take about 5 minutes no more.


Don't Feel Like Reading? We Made a Video Explaining the Full Details of the Topic. Click Here to Scroll Down to The Video

Steps

1. Login to Shopify Backend
2. Create your search terms redirects CSV via this template. (one row for terms and one row for full url to redirect to) - here you will be placing your terms and where to redirect to.
3. Complete CSV with terms and redirects. Save as CSV & Upload to files via Content
4. Copy the code template from https://github.com/onescales/shopify-redirect-zero-results/blob/main/searchresults.liquid
5. Add code to your theme. Click on Online Store -> Themes -> Customize your theme. Edit your search.liquid page and at top of page, paste the code. *Make sure to change row 8 "FULL-URL-HERE" with the full url of your file from above step 3.
6. Start Using It. Enjoy!

Additional Notes

- All code and instructions are as is. By reading this repository, readme or any code, you acknowledge that you are solely responsible for your own doings.

Suggestions, Comments and Contact

If you have any suggestions, comments, insight or just want to say hi, thanks or share your experience, let us know



View Entire Topic Via Our Youtube Walkthrough:

Leave a comment

Please note, comments need to be approved before they are published.

Tags

Thank You For Reading Our Articles!

We're committed to delivering real answers, valuable insights, and efficient knowledge online. Join us by subscribing, sharing, and engaging with our community to make a difference!