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

If you would like to replace Storefront‘s product search with the search facility provided by WooCommerce Product Search, 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.

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top