How do I turn off search bar suggestions on my store?

Solved
BeautyBuffetInd
Excursionist
39 2 4

Hi all

I have the following store that I have built using envato themes: www.beautybuffesthop.in

Whenever a customer wants to search for a product, e.g. 'mask', they need to wait for the suggestions to come (a few seconds) and if they press enter before selecting from the suggestion, it takes them to a 404 page.

 

How do I turn off these suggestions so that customers can search whatever they want and the best results are shown on a page?

 

Thank you

0 Likes
Visely-Team
Shopify Partner
1837 210 420

This is an accepted solution.

In your Theme Code editor find the file assets/ajax-search-script.js (can also have a suffix) and locate a snippet like this:

    //Search box should mimic live search string: products only, partial match
    $('.ajaxsearch, .search-form').on('submit', function(e){
      e.preventDefault();
      var term = '*' + $(this).find('input[name="q"]').val() + '*';
      var linkURL = $(this).attr('action') + '?type=product&q=' + term;
      window.location = linkURL;
    });

Adjust the line:

var linkURL = $(this).attr('action') + '?type=product&q=' + term;

so it reads:

var linkURL = $(this).find('form').attr('action') + '?type=product&q=' + term;

You should get both working as expected.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
BeautyBuffetInd
Excursionist
39 2 4

You are amazing. The explanation was so clear and apt. Thank you so so much!

0 Likes
farrago
New Member
1 0 0

how do i do this for minimal theme in shopify ? 

0 Likes