How to display only products in search results in Dawn theme

Solved

How to display only products in search results in Dawn theme

Nishant24
Excursionist
29 0 10

Hello, I am using the shopify's free Dawn theme at the moment and I sell printed merchandise on my store but I also have several pages and articles for SEO purposes. 

Whenever I search a term on my search bar from home on the website, the results are not just products but also blogs and pages that contains the search term. This looks extremely untidy and irrelevant (check screenshot where the first 3 results are pages before the 1st product is displayed on searching "t shirt" from the home page search bar)

 

I want to just display the products in search results, pages and blogs have their own navigation menu that shouldn't appear in search results. 

 

Can anyone help me with this? I searched on Google and scrolled through many articles where I found a single line code to block the pages and articles but there is no clear indication of where to exactly put that code. When I paste it into search.liquid file, I just can't get rid of my problem. Any help and suggestions will be much appreciated. Thank you. 

Accepted Solution (1)

LitExtension
Shopify Partner
4915 1005 1183

This is an accepted solution.

Hi @Nishant24,

Please follow the steps below: 

- Step 1: Go to header.liquid file, find 'routes.search_url' and add code here:

Screenshot.png

- Step 2: Go to main-search.liquid file, find 'routes.search_url' and add code here:

Screenshot (1).png

Code:

<input type="hidden" name="type" value="product">

Refer: https://shopify.dev/themes/navigation-search/search#the-search-form

Hope it helps!

 

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com

View solution in original post

Replies 5 (5)

Chuckachucka
Excursionist
13 0 8

I've been trying to find a solution to this issue as well. Please let me know if you're able to fix it. Screen Shot 2022-07-29 at 12.25.22 PM.png

LitExtension
Shopify Partner
4915 1005 1183

This is an accepted solution.

Hi @Nishant24,

Please follow the steps below: 

- Step 1: Go to header.liquid file, find 'routes.search_url' and add code here:

Screenshot.png

- Step 2: Go to main-search.liquid file, find 'routes.search_url' and add code here:

Screenshot (1).png

Code:

<input type="hidden" name="type" value="product">

Refer: https://shopify.dev/themes/navigation-search/search#the-search-form

Hope it helps!

 

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
Chuckachucka
Excursionist
13 0 8

Hi @LitExtension, it has worked on my desktop view, but on my mobile it's still having the same problem. Is there a problem?

Nishant24
Excursionist
29 0 10

Hello @LitExtension , thank you so very much for solving this query for me. Now there are no issues in the delivery of search results. 

jennifervdz
Shopify Partner
22 0 7

It worked for me, Thank you!