Display WooCommerce search results in FacetWP page
To make the search results appear on your facet page, add a search facet to the page and then just add these to your functions.php:
- YOUR_FACET_SEARCH_WIDGET_NAME – with the name of your facet
- YOUR_RESULT_PAGE – with the slug of you facet page
/** * use facetwp results as results for normal search form */ add_filter( 'get_product_search_form', function ($form) { $form = str_replace('name="s"', 'name="YOUR_FACET_SEARCH_WIDGET_NAME"', $form); $form = preg_replace('/action=".*"/', 'action="/YOUR_RESULT_PAGE/"', $form); return $form; } );
The same thing can be done for the normal WordPress search form
add_filter( 'get_search_form', function( $form ) { $form = str_replace( 'name="s"', 'name="YOUR_FACET_SEARCH_WIDGET_NAME"', $form ); $form = preg_replace( '/action=".*"/', 'action="/YOUR_RESULT_PAGE/"', $form ); return $form; } );