Change "search" on the top of search page with the actual number of search results

Solved

Change "search" on the top of search page with the actual number of search results

flammagreg
Trailblazer
276 0 39

Hi guys,

 

Website: Vossani.com

 

How can I change the "SEARCH" on the search page to the actual number of results? Pic for reference:

Screenshot 2024-07-18 at 8.57.07 PM.png

Accepted Solution (1)

BSSCommerce-HDL
Shopify Partner
2305 835 907

This is an accepted solution.

Hi @flammagreg

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </body> tag: 

 

<script>
  let search_text = document.querySelector('.search--header h1.page--title');
  let search_results = document.querySelectorAll('.search-wrapper .grid__item .grid__item.one-third');
  if(search_results && search_text) {
    let text = search_text.innerText;
    search_text.innerText = text.replace('SEARCH', search_results.length)

  }
</script>

 

Here is result: 

BSSCommerceHDL_0-1721352204156.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

View solution in original post

Replies 2 (2)

MaverickStudio
Shopify Partner
101 32 35

Hey @flammagreg 

It is difficult to do it without access to the store but here is a general way of doing it.

Step 1: Go to Online Store > Theme > Edit code > find the search.liquid or main-search.liquid file 

Step 2: Find the line with the text {{search.terms}}
Step 3: Replace the first word of that line with {{ search.results_count }}

I can send you a collaborator request if needed. Please check your  DM




♥ If you found my solution helpful, please consider giving it a  Like and marking it as the  ✔ Accepted Solution


Try our WhatsApp Chat Button Widget with multipe agents. Supachat: WhatsApp Chat Button


A Product of  Maverick Studio

BSSCommerce-HDL
Shopify Partner
2305 835 907

This is an accepted solution.

Hi @flammagreg

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </body> tag: 

 

<script>
  let search_text = document.querySelector('.search--header h1.page--title');
  let search_results = document.querySelectorAll('.search-wrapper .grid__item .grid__item.one-third');
  if(search_results && search_text) {
    let text = search_text.innerText;
    search_text.innerText = text.replace('SEARCH', search_results.length)

  }
</script>

 

Here is result: 

BSSCommerceHDL_0-1721352204156.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now