Write custom search app in shopify

别来无恙 提交于 2019-12-06 09:37:51

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.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!