The WooCommerce Product Search extension helps to control and improve the relevance of search results and adds facilities that supply instant results while visitors search for products.
Installation ↑ Back to top
- Download the .zip file from your WooCommerce.com account.
- Go to: WordPress Admin > Plugins > Add New to upload the file you downloaded.
- Activate the extension.
More information at:.
Setup and Configuration ↑ Back to top
The plugin is put to use quickly by enabling enhancements and deploying search facilities.
Search Weights ↑ Back to top
Enable the use of weights to improve the relevance in product search results, based on search keyword matches in product titles, excerpts, contents and tags.
To enable the use of weights, go to WooCommerce > Settings > Search, check the option Use weights and save the settings.
Weights can also be set for specific products and product categories.
Instant Search ↑ Back to top
An instant search facility is deployed by placing a simple shortcode
on a page or by using the WooCommerce Instant Product Search widget that comes with this extension.
The widget settings are as follows:
Theme developers can also use the plugin’s API to include it in a template.
Please refer to the following sections for details:
Note that the standard search fields and widgets are not affected by this extension. The search facilities that it provides are meant to replace the standard facilities where desired.
Customization ↑ Back to top
Use Product Search instead of the default search
You need to edit your theme’s search-form.php file, preferably using a child theme to preserve customizations against upgrades. More here: How to set up and use a child theme
From your parent theme’s search-form.php template file, copy it from the parent theme directory to your child theme directory and edit to conditionally output the WooCommerce Product Search (if it exists). The following snippet demonstrates one way that this might be accomplished, in this case placing it at the beginning of the search-form.php file:
If using Storefront or one of the Storefront child themes, there isn’t a search-form.php file.