Skip to content

Instantly share code, notes, and snippets.

@itthinx
Created November 15, 2017 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itthinx/d72dbe722d9a314e0ec96c84f0482f6a to your computer and use it in GitHub Desktop.
Save itthinx/d72dbe722d9a314e0ec96c84f0482f6a to your computer and use it in GitHub Desktop.
Using WooCommerce Product Search and replacing the default Search Form in Storefront and its child themes
<?php
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
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment