From 922b21ba1fe5dd13b040f5ca02d5a3424c5ec252 Mon Sep 17 00:00:00 2001 From: Erik Golinelli Date: Sat, 9 Oct 2021 02:01:32 +0200 Subject: [PATCH] Enable the live search also for WooCommerce search Since WooCommerce has introduced [wc_widget_product_searchwidget](https://woocommerce.wp-a2z.org/oik_api/wc_widget_product_searchwidget/) it would be really nice (and also easy) to add live search for the WooCommerce search widget as well... since it only searches among the products and the search returns a WooCommerce page with the queried products it would be an interesting feature to add. --- includes/class-form.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-form.php b/includes/class-form.php index 4bcb165..df62cc7 100644 --- a/includes/class-form.php +++ b/includes/class-form.php @@ -79,6 +79,11 @@ function setup() { add_filter( 'get_search_form', array( $this, 'get_search_form' ), 999, 1 ); add_action( 'wp_footer', array( $this, 'base_styles' ) ); + // WooCommerce widget search integration. + if ( class_exists( 'woocommerce' ) ) { + add_filter( 'get_product_search_form', array( $this, 'get_search_form' ), 999, 1 ); + } + // Gutenberg integration. add_filter( 'wp_footer', array( $this, 'gutenberg_integration' ) );