How can I hide certain products from search results on my site?

We are trying to hide some of our products from showing up in our search results, on our site. We have some free samples that customers are able to select at checkout but we don’t want them to be able to search for these products. We don’t want to have to use another app and we are currently using the Venue theme.

Hey @Joe_Hanni

To hide specific products from showing up in search results on your Shopify site without using an app, you can make use of product tags and modify the search functionality in your theme. Here’s a step-by-step guide on how to achieve this in the Venue theme:

  1. Start by identifying the products you want to hide from search results. Let’s say you want to hide products tagged as “Free Sample”.

  2. Go to your Shopify admin and navigate to Products.

  3. Select one of the products you want to hide from search results.

  4. Scroll down to the Tags section and add the tag “Free Sample” to the product. Save the changes.

  5. Repeat the process for all the products you want to hide from search results by adding the “Free Sample” tag.

  6. Now, let’s modify the search functionality in the Venue theme to exclude products with the “Free Sample” tag.

  7. From your Shopify admin, go to Online Store > Themes.

  8. Find the Venue theme you are using and click on the Actions dropdown menu, then select Edit code.

  9. In the theme code editor, locate and open the search.liquid file. This file is usually found under the Snippets or Sections folder.

  10. Inside the search.liquid file, find the code block responsible for displaying search results. It could be something like {% for result in search.results %}.

  11. Add the following condition inside the loop to exclude products with the “Free Sample” tag:

{% unless result.object.tags contains 'Free Sample' %}
  
{% endunless %}
  • Save the changes to the search.liquid file.

Now, when a customer performs a search on your site, products tagged as “Free Sample” will be excluded from the search results.

Remember to test the search functionality thoroughly after making these changes to ensure that the desired products are no longer showing up in the search results.

Please note that modifying theme code requires some knowledge of Liquid and HTML. If you’re not comfortable making these changes yourself, it’s always a good idea to consult with a Shopify expert or developer who can assist you in customizing your theme accordingly.

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed