Morning Dough
To: Dough Readers


How to Improve Custom Search in Your Shopify Store

Shopify’s online store search function is a fully featured, powerful tool for buyers to search across all of a shop’s products, articles, and pages. Sometimes, however, your clients may want to optimize their search so that buyers are seeing specific types of results. This is especially relevant if your clients have a large product inventory or a lot of non-product content. As your clients’ stores become more complex, they may require a more nuanced search process to filter out certain results or prioritize products over regular pages. This is where working with custom search options comes into play.

Discover the ways search results can be refined to hide unavailable products or prioritize product pages on your Shopify store.

Shopify Searching Basics

Before we look at customizing search results, it’s worthwhile to explore some of the important Liquid objects related to search. Being familiar with these variables means that you will be able to build the right search model for your client. Here are a few objects to take note of:

search.results is a powerful Liquid object which returns an array of matching search result items. The items in the array can be blog articles, regular pages, or products. What is very useful is that it is possible to isolate and access the attributes of individual search objects by using for loops.

search.terms returns the words which were originally searched for. It’s possible to use the highlight filter to apply a different style to any instances in the search results that match up with search.terms. This is particularly helpful if you want to draw a visitor’s attention to these words.

and, or and not operators. By default search terms are “and-ed” together, so any results will include all terms searched. or can be used to generate results which contain at least one instance of the search terms, while prefixing a term with a minus sign will remove results with this term.

Read more here.