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.
- Login to Shopify Backend
- Create your search terms redirects CSV via this https://github.com/onescales/shopify-redirect-zero-results/blob/main/Shopify-Search-Redirects.csv (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.
- Complete CSV with terms and redirects. Save as CSV & Upload to files via Content
- Copy the code template from https://github.com/onescales/shopify-redirect-zero-results/blob/main/searchresults.liquid
- 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.
- Start Using It. Enjoy!
- 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.
Hope you liked this!
If you have any suggestions, comments, insight or just want to say hi, thanks or share your experience, you can contact us at:
- Our WebSite: https://onescales.com/
- Contact Us: https://onescales.com/pages/contact
- Youtube Channel: https://www.youtube.com/@onescales
- Twitter/X: https://twitter.com/one_scales
- LinkedIn: https://www.linkedin.com/company/one-scales/