When customers visit your Shopify store and search for products, they might sometimes encounter zero search results. This isn't a great experience—they may feel frustrated and leave your site. To improve user experience and keep potential customers engaged, you can redirect these zero-result searches to more relevant pages, such as discount pages, collections, or specific products.
Here's how you can set this up in a few simple steps:
1. Identify Zero-Result Search Terms
First, find out which search terms are leading to no results:
-
Navigate to Analytics Reports:
- Go to your Shopify admin dashboard.
- Click on Analytics > Reports.
-
Access the Search Report:
- Use the search bar to find reports related to "Search".
- Select Top online store searches with no results.
-
Review the Data:
- The report will display search terms that returned no results and how often they're searched.
- Take note of the terms you want to address.
2. Prepare a Redirect List
Create a list of search terms and the URLs you want them to redirect to:
-
Download the Template CSV:
- Access our GitHub repository and download the template CSV file.
-
Edit the CSV File:
- Open the CSV file in Google Sheets, Excel, or any spreadsheet software.
- In Column A, list the search terms you want to redirect.
- In Column B, enter the full URLs where you want to redirect those terms.
- For example, if someone searches for "Pikachu", you might redirect them to a specific product page.
-
Save the CSV File:
- Ensure there are no empty rows or additional columns.
- Save the file in CSV format.
3. Upload the CSV File to Shopify
-
Access the Files Section:
- In your Shopify admin, go to Content > Files.
-
Upload the CSV File:
- Click on Upload files.
- Select your CSV file and upload it.
-
Copy the File URL:
- After uploading, find your file in the list.
- Click on it and copy the URL for later use.
4. Modify Your Theme Code
Implement the redirection logic in your theme:
-
Duplicate Your Theme (Recommended):
- Go to Online Store > Themes.
- Click on Actions > Duplicate to create a backup.
-
Edit the Code:
- Click on Actions > Edit code for the theme you want to modify.
-
Find the Search Template:
- Use the search bar to locate your search template file (e.g.,
main-search.liquid
orsearch.liquid
). - If unsure, consult your developer or theme documentation.
- Use the search bar to locate your search template file (e.g.,
-
Insert the Redirect Code:
- Scroll to the top of the file.
- Paste the code snippet from our GitHub repository.
-
Update the CSV File URL:
- In the code you just pasted, locate the line where it says
full-url-here
. - Replace
full-url-here
with the URL of the CSV file you copied earlier.- Remove any query parameters (anything after
?
) from the URL.
- Remove any query parameters (anything after
- In the code you just pasted, locate the line where it says
-
Save Your Changes:
- Click Save to apply the modifications.
5. Test the Redirection
Ensure everything works as intended:
-
Perform a Test Search:
- Go to your store and search for one of the terms you set up (e.g., "Pikachu").
-
Verify the Redirect:
- Confirm that the search redirects to the correct URL you specified.
-
Test Multiple Terms:
- Repeat the process for other search terms to ensure all redirects are functioning.
Important Notes
-
Be Precise with the CSV File:
- Only include the search term and the full URL.
- Avoid empty rows or additional columns.
- Ensure URLs start with
https://
.
-
Regular Updates:
- Over time, you may need to add or remove redirects.
- When updating, edit your CSV file accordingly.
-
Replacing the CSV File:
- To update the CSV without changing the code:
- Go to Content > Files.
- Find your CSV file and click Replace.
- Upload the updated CSV file with the same name.
- This way, the code continues to reference the correct file.
- To update the CSV without changing the code:
Additional Tips
-
Optimize Your Store's Search Functionality:
- Regularly review search analytics to understand customer behavior.
- Consider optimizing product tags, descriptions, and keywords.
-
Enhance User Experience:
- Redirecting zero-result searches can improve customer satisfaction.
- Keep your redirects updated to reflect current products and promotions.