skip to Main Content

I need to implement our own custom product search in Shopify, but I have been unable to find out how exactly to do this.

I am not talking about the template which shows the search result, but we need to write custom code to decide exactly which products should be shown on the search page, and their order.

I can see there are a lot of apps out there which provides a custom search result/order so I guess it is possible to do, I was just unable to find any documentation about it.

I already have all the data needed to produce the desired search result, so my only problem is how to integrate with Shopify, so that Shopify send the search to our app, and then display the products our search app returns.

—- ADDED —-

What I would like in a perfect world, is that when the user does a search, Shopify should send the search phrase to our server. We would then generate an ordered list of product matches and return that list to shopify. Shopify would then present the products to the user, exactly as if the products were found by shopify using the internal shopify search engine.

But it seems like i might have misunderstood how that google search thing worked, and it seems like what I want is simply not possible.

2

Answers


  1. To customize the search result in your shopify store you have to manipulate the search result provided by the search result. To do so you have to find in your theme where logic for search operation is written.

    Mostly you will find it in search.liquid file. You need to filter the search result there. Suppose you want to restrict products of particular vendor in the search result then you can do it as follow.

    {% for item in search.results %}
        {% if item.vendor != 'Reebok' %}
          {% include 'search-result' %}         
        {% endif %}
    {% endfor %}
    

    Here search-result will be the snippet responsible represent each search result in the search list. Simillarly you have to manipilate the search result pagination too.

    Login or Signup to reply.
  2. You have two different resources to do this.. One talks about search filters and the other talks about customizing the search results

    https://help.shopify.com/manual/sell-online/online-store/storefront-search

    https://help.shopify.com/themes/customization/store/enable-autocomplete-for-search-boxes

    The first links talk about how you can modify the search terms using a combination of parameters on search query.

    The second talks about how to load search results on a page and call them to your frontend using AJAX and JS

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search