search object
The search on the search page. It is set on the search template only.
Properties
| Name | Type | Description |
|---|---|---|
terms | string | The searched words, from the q query parameter |
performed | boolean | Whether there are search terms |
results | array of product object | The matching products, 50 at a time. Use paginate for more. Empty when performed is false |
results_count | number | The number of matching products |
The results use the sort_field, sort_order and filters query parameters of the page.
liquid
<form action="/search">
<input type="search" name="q" value="{{ search.terms }}">
</form>
{% if search.performed %}
{% paginate search.results by 24 %}
<p>{{ search.results_count }} results</p>
{% for product in search.results %}
{% render 'product-card', product: product %}
{% endfor %}
{% endpaginate %}
{% endif %}