Menu Close

Get Support From ShopWired Close

All Systems Are Operational

Subscribe To Updates
Prefer To Live Chat? Chat directly with ShopWired support Available 9.00am to 7.00pm Monday to Friday
11.00am to 5.00pm Saturday
Quickest response time

Send A Message
Response within 24 hours

Menu Close

Menu

Search products

To include a search form in your theme, you just need to create an HTML form with its action attribute set to /search/products

Within this form you should have an input of type text with a name attribute set to to keywords.

An example is shown below.

<form action="/search/products" method="get">
    <input type="text" name="keywords">
    <button type="submit">search</button>
</form>

Once the search form has been submitted the user will be taken to the search view.

The keywords that a user has searched with can be outputted using the {{ keywords }} variable.

By default, the search form is submitted with the relevancy sort order pre-selected. Optionally, you can include a field within the form to set the order of search results as desired. Available values are listed in the sorting products section of the collection.twig documentation.

An example is shown below.

<form action="/search/products" method="get">
    <input type="hidden" name="sort" value="title_asc">
    <input type="text" name="keywords">
    <button type="submit">search</button>
</form>