The Shopify storefront search function is a wonderful tool for your customers that empowers them to search all of your shop’s products, articles, and pages in an easy to navigate manner.
To do so they may choose to search in a traditional way, or to employ operators.
A search operator is a linking term that joins search terms together, allowing for a more in-depth search.
Search using AND, OR and NOT operators:
AND
All search terms in Shopify are by default AND-ed together. This means that if you are searching for:
checkers shirt
That your search results will contain both “checkers” and “shirts” products, articles, or pages.
So, to employ the AND operator, you do not actually need to include the AND operator between search terms, as Shopify reads it as such regardless of the placement of AND between search terms.
OR
Search variations starts from OR. If you want to display search results that would contain at least one search term, insert OR in between search terms. So for OR, you can try searching like this:
checkers OR shirt
The search engine results generated from this query will contain at least one of the search terms. So, “checkers” or “shirt”. So, if you aren’t exactly sure what the product is that you are searching for, adding OR between search query terms is a good solution.
NOT
If you want to search for any product, article or page but want to exclude any search term, you can achieve that by prefixing the term with a “-” sign.
checkers -shirt
This will generate search engine results that match “checkers” but not “shirt.”
This operator is best utilized when you want to enter a long search term, but want to exclude any single search term to make your search more effective.
Restricting Search Results
You can restrict the type of search results that will be generated in your store’s front end.
For example, if you want the search results to display only products and not pages or articles.
You can include the type query parameter in front of the store URL like this:
/search?q=snowboard&type=product
Or if you only want to search for articles and pages within a certain body of text.
You can include the type query parameter in front of the store URL like this:
/search?q=snowboard&type=article,page
This is where the type will be the of a combination of product, article, and page separated by commas. Which directly impacts the way you display and filter the search results. If you don’t enter any type, then by default all three types will be searched.
This can be accomplished using a hidden field in the search form within theme.liquid
<form method=”get” action=”/search”>
<input type=”hidden” name=”type” value=”product” />
…
</form>
You can reach theme.liquid by doing the following:
Step#1 Go to the admin section of your Shopify store. Once logged in you will see the Dashboard section of your store
Step #2: Open your settings and go to “Online Store” and then click “Themes”
Step #3: Click on “Actions” on the right part of your screen then click “Edit Code”
Step #4: Click on the “Layouts” folder and open the “theme.liquid” file.
Step#5: Use Ctrl+F(for windows) and CMD+SPACE BAR(for mac) and search the keyword “search”. You will locate the search form below
Searching specific fields or terms:
For searching any specific field or term just prefix a term with a field name and colon to narrow your search for that term in order to generate a specified term in the search results:
For example:
title:checkers
This will search for the items that specifically have checkers in their title, and will generate the results for you.
You can use the following fields for products, pages and articles:
Product fields
- title
- handle
- body
- vendor
- product_type
- tag
- variant
- sku
Page fields
- title
- handle
- body
- author
Article fields
- title
- body
- author
There you have it.
You have now learned more about what search operators are, and how to limit end users access to your search results. You can not only limit this way, but can augment their search experience.
Any opportunity you have to enhance an end user’s experience should be grasped! Good luck- and happy selling!
Comments