We need to exclude certain products from the search results on search template.
We already used {% unless %} inside result to filter results but we are looking for a way that these certain products should completely exclude form the results instead of rendering in results and then filtering it with {% if %} statements etc.
Any help will be highly appreciated!
Hi @abrar_anwar ,
Shopify provides a method to hide products in your store from Google and other search engines. Using this method also hides the product from Shopify’s site search. Basically, you need to set the seo.hidden metafield for the product to ‘1’ (stored as an integer).
However, the product still can appear under the search recommendation. Therefore, you’ll need to disable product suggestions from your theme editor.
I hope it helps.
1 Like
As far as I know, using conditions in rendering may lead to distorted search result product grid and is not ideal. A complete solution is to use a search & filter app that support merchandising rules like this https://apps.shopify.com/ultimate-search-and-filter-1. You can easily exclude certain products from your search page by following the steps below in the app:
-
Go to Search / Merchandising rules
-
Create a rule and select Exclude.
-
Then you can select how your products are excluded: by tags, collections, vendors, colors, size, stock status, sku, metafields, etc.