This section is provided for WooCommerce developers who want to deploy the advanced search facility with specific themes. You may need an advanced understanding of PHP and WordPress development. If you need help to resolve issues with a particular theme (not customizations), please contact support. If you are not a developer but would like to find one to help with customization, select a WooExpert or Developer for assistance.
Here we provide some suggestions for adjustments with themes. If you have a question about or issues with a particular theme, please contact support.
Storefront
↑ Back to topAs of version 2.0.0, the extension will replace the standard product search form automatically and no modifications in Storefront and its child themes are required. The related settings can be adjusted in the General settings under WooCommerce > Settings > Search > General.
If you would like to replace Storefront‘s product search with the search facility provided by WooCommerce Product Search and are using at least version 2.0.0 of the extension, the standard product search field will be replaced automatically. The related settings can be adjusted in the General settings under WooCommerce > Settings > Search > General. If you prefer to disable this option or are using a previous version, you can add the following code that uses its API to your theme’s functions.php
.
/**
* This function replaces Storefront's product search function.
* It will render the WooCommerce Product Search widget instead of
* the default widget when the extension is enabled.
*/
function storefront_product_search() {
if ( function_exists('storefront_is_woocommerce_activated' ) ) {
if ( storefront_is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php
if ( function_exists( 'woocommerce_product_search' ) ) {
echo woocommerce_product_search();
} else {
the_widget( 'WC_Widget_Product_Search', 'title=' );
}
?>
</div>
<?php
}
}
}
You can also download this Storefront Child Theme which contains the adjustment and reuse it.