The plugin can be used in 3 ways:
To add the search form through the widget, click on “Appearance -> Widgets” and add the “YITH WooCommerce Product Search” widget to the sidebar as shown in the example.
The widget has two options:
- Template wide: if enabled, the form will adjust to the whole width of the page
- Filter above: by default, all the field forms are arranged on a unique line.
By enabling this option, the search box will be arranged on a different line in relation to other possible available fields (category list and filter for search field).
By clicking on YITH Plugins -> Ajax Search from WordPress dashboard you will find the settings dashboard where you can set up some parameters of the plugin.
In “General settings” you can set up the following options:
- search box label
- search button label
- minimum number of requested characters to launch Ajax Search
- maximum number of displayed results in the box
The above-described section could be unavailable if the theme doesn’t support the specific features.
Provided options allow the user to choose the filters to apply to contents search:
- “Show filter for search fields”: allows extending the search to all site contents or only to products
- “Show the category list”: allows filtering search results on the strength of a selected category, filter on category even without typing a keyword.
The “Search” section of settings dashboard includes the complete list of options through which you can set up search ajax parameters on the site.
Search can be extended to the following components:
- all site contents or only products
- posts and pages content
- product categories
- product tag
- custom field
- product identifier (SKU)
The “Multiple Word Search” option allows showing those site components that include all or one of the keywords inserted by users.
With the “Hide out of stock products” enabled, you will only search for products that are in stock.
Cache result in transient
To speed the search of the contents on your site, you can use some transients and enable the “Enable transients to cache autocomplete results” entry.
The result of each search query is stored in a transient for the same duration you set.
This way, if a search is applied before the transient expiration, the system will fastly recover the result previously obtained.
The search results can be sorted according to the related post type.
Enable the “Enable order by post type” option and select the products and post & pages you want to show first.
The “Output” page includes the options to select single products information to show, obtained from image search (size and position), product variations and/or price search.
You can show the form in two different templates: the default one or the “Wide” style one which takes up the whole available space in width.
In case of an ‘on sale’ or ‘highlighted’ product (“featured” product), a badge will be applied to the results.
Options allow you to change the style and colors of the shown badges.
Title & Excerpt section allows showing product excerpt, to customize text length and title color.
By activating “View All” Link option, a link will be added to the bottom of the search results section. In this way, users can check the page that includes all components of their search parameters.
If you are using the plugin in combination with YITH WooCommerce Multi Vendor, you can enable the search by vendor.
If you enable the option, the list of the specific vendor’s products will be shown by simply typing his/her name.