WooExperts Banner on Doc Pages

  1. Documentation /
  2. WooCommerce Product Search /
  3. Version 1.x and WooCommerce 2.x /
  4. Themes

Themes

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 customizationselect 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 top
As 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.

Other Themes

↑ Back to top
The WooCommerce Product Search extension will replace the standard product search field with its live Product Search Field automatically if the theme uses the appropriate API function to render the search field and the replacement option is activated. For cases where the automatic replacement is not possible, the extension provides its own API which can easily be used in templates. Please refer to the API documentation page for an example. Of course you can simply add the Product Search Field widget to a sidebar.