Before you implement predictive search, make sure that you’re familiar with the following [user interface (UI)](#ui-requirements) and [accessibility](#accessibility-requirements) requirements, and [user experience (UX)](#ux-best-practices) best practices. These include guidance for displaying products, styling the search field, and creating a search experience that is both accessible and mobile friendly. You can also refer to [Example search patterns](#example-search-patterns) for example UIs. ## UI requirements
Requirement | Description |
---|---|
Number of resources shown |
|
Close action |
Include a close button, in the form of an icon or text, that leaves the search experience and closes the product suggestion dropdown. This action should not clear the query. |
Search action |
Include a search button, in the form of an icon or text, that takes the user to the search results page. This should also be able to be achieved by clicking enter on a keyboard, or "go"/"search" on a mobile keyboard. |
Clearing query |
The query should stay in the search field until the customer explicitly clears the query or navigates to a different page. The searched query should be also repeated on the search results page. |
Empty state |
Hide the empty-state drop-down when there are no product suggestions that match the query. The lack of feedback from predictive search should encourage customers to continue their search from the results page. |
Mobile interactions |
|
Desktop interactions |
|
Requirement | Description |
---|---|
Browser and mobile autocomplete | Disable browser-based autocomplete and search history, as well as mobile OS text autocorrect and autocomplete. These kinds of functionality can disrupt the UI through overlays, and the general experience with competing autocomplete logic. |
Practice | Description |
---|---|
Resource information |
Reduce search interface content and resource data to the minimum amount necessary to make selection meaningful. Using the API, you can control which elements are exposed or hidden, so you can adapt this to the needs of the merchant, however you should consider only exposing the following fields: Query fields
|
Query suggestions |
As you add query suggestions to your theme, we recommend to highlight the suggested portion instead of what the buyer types. For example, if the buyer types card and the query suggestion is cardigan, then present it as cardigan instead of cardigan. This makes it easier for buyers to scan the list of suggestions. |
Labels |
Only show a "Sold out" label for suggested products when the entire product is unavailable. Use a heading to label product suggestions to help users anticipate the type of results they can expect. For example, use a "Products" heading for product suggestions. |
Actions |
Include a clear button, or text, in the search field to delete any query entered. |
Search visibility |
Display the search field, or at least the search icon, in the header of all pages. If search is a significant element of the overall experience you want to provide, then make sure that it’s displayed prominently. For stores with only one product or a small number of products, the search field can be located within a hamburger menu. |
Darken page background |
As you design the overall predictive search dropdown, darken other parts of the page background while autocomplete is active to help buyers focus. |
"More results" links |
Display a link in the list of product suggestions to indicate that there might be more results on the search results page.
For example, the link could include the text "Search for [your query]", where |
Predictive search results appear under the search field in the menu.
Alternatively, the search field can be positioned at the top of the menu. In this case, product suggestions would overlay the menu list (see the in-menu mobile example for this layout).