The search object
This page was printed on May 24, 2019. For the current version, visit https://help.shopify.com/en/themes/liquid/objects/search.
search object has the following attributes:
true if an HTML form with the attribute
action="/search" was submitted successfully. This allows you to show content based on whether a search was performed or not.
Returns an array of matching search result items. The items in the array can be a(n):
You can access the attributes of individual search results by looping
Search results have an additional attribute titled
object_type which returns the type of each result. This is useful for writing the logic of your search results loop.
Returns the number of results found.
Returns the string that was entered in the search input box. Use the highlight filter to apply a different style to any instances in the search results that match up with
Returns an array of strings representing the types the search was performed on.
The items in the array can be any combination of
The search types can be seen in the URL parameters of a search page. For example,
storefront.com/search?type=article,product&q=* will have a
search.types array containing