Search
The search object provides access to search results, filters, and pagination for the store’s search page.
Usage Example
{%- comment -%} Render search results with active filters {%- endcomment -%}
<p>{{ search.result_count }} results for "{{ search.search_term }}"</p>
{% for product in search.results %}
<div>
<a href="{{ product | link }}">{{ product.title }}</a>
</div>
{% endfor %}
{% if search.active_filters.size > 0 %}
<ul>
{% for filter in search.active_filters %}
<li>{{ filter.label }}</li>
{% endfor %}
</ul>
{% endif %}Properties
result_count
Returns the number of results on the current search page.
all_results_count
Returns the total amount of results for this search.
results
Returns the products matching the current search page.
search_term
Returns the search term entered by the customer.
filters
Returns the available filters for this search, null if none is set.
active_filters
Returns the active filters for this search, null if none is set.