This section is provided for WooCommerce developers who want to deploy the advanced search facility directly in theme templates. You need an advanced understanding of PHP and WordPress development. If you are not a developer but would like to find one to help with customization, select a WooExpert or Developer for assistance.

Search Form in PHP templates ↑ Back to top

Use the woocommerce_product_search() function to render the search facility in PHP templates.

This function accepts an array of options as described for the shortcode. See the page Shortcodes for details on the parameters that can be passed to this function.

Example ↑ Back to top

  if ( function_exists( 'woocommerce_product_search' ) ) {
    echo woocommerce_product_search( array( 'limit' => 20 ) );

This code can be used in any template file, for example, you could add it to your theme’s single-product.php template.

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

Back to the top