Hide number of search results (debut theme)

Solved
SneakerSafe
Explorer
53 0 13

Hi community

my website is sneakersafe.co.uk

Because I'm using an app, it gives me results for mispelled words. How can I hide the number of search results for both 0 results and n results? All of the text circled. Thank you

SneakerSafe_0-1612279066903.png

SneakerSafe_1-1612279087540.png

 

0 Likes

This is an accepted solution.

Hi @SneakerSafe 

This solution requires editing of your theme code. Edit the code for a theme only if you know HTML and CSS, and have a basic understanding of Liquid. To know more what is theme editing, please visit:

https://help.shopify.com/en/manual/online-store/os/using-themes/managing-themes/duplicating-themes

Before you customize your theme, it's a good idea to duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to. Here are steps to duplicate a theme:

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

2. For the theme that you want to duplicate, click Actions > Duplicate.

 

Solution of your specific issue:

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

2. Find the theme you want to edit, and then click Actions > Edit code.

3. In the Templates directory, click to open your search.liquid file.

4. Find the following piece of code in search.liquid file (usually begins at line#4):

  {% if search.performed == false %}
    <div class="text-center">
      <h1 class="h2">{{ 'general.search.title' | t }}</h1>
  {% else %}
    <div class="text-center">
      <h1 class="h2">
        <span class="visually-hidden">{{ 'general.search.heading' | t: count: search.results_count }}:</span>
        {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
      </h1>
  {% endif %}

 

5. Replace the above piece of code with the following code:

    <div class="text-center">
      <h1 class="h2">{{ 'general.search.title' | t }}</h1>

 

6. Save the changes.

I hope this will help.

Thanks!

Suman Saurabh | Expert in Shopify Development
✅ Was my reply helpful? Please Like & Accept Solution
✅ Want to hire me? Send PM or Skype: omnisitecreations
SneakerSafe
Explorer
53 0 13

Hi @SumanSaurabh 

thank you for your help, but I still get some text when I search for something

SneakerSafe_0-1612283728627.png

The top line appears in every search, and the bottom line appears when the search result number is 0

0 Likes
SneakerSafe
Explorer
53 0 13

Solved! I changed 'general.search.title' to :empty

0 Likes

This is an accepted solution.

@SneakerSafe 

That's great!

You can also remove the following code from search.liquid file to remove the line "Try checking your spelling or using different words"

 

          {% if search.performed and search.results_count == 0 %}
            <div class="rte search--no-results-found">
              <p>{{ 'general.search.no_results' | t }}</p>
            </div>
          {% endif %}

 

Thanks!

Suman Saurabh | Expert in Shopify Development
✅ Was my reply helpful? Please Like & Accept Solution
✅ Want to hire me? Send PM or Skype: omnisitecreations