facetwp woocommerce_redirect_single_search_result

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** prevents woocommerce’s redirect single research result during an facetwp ajax request and
** when facet variables are pre-loaded in the url
**/
add_action( ‘template_redirect’, function() {
if ( function_exists( ‘FWP’ ) && ( FWP()->ajax->is_refresh || FWP()->facet->is_preload ) ) {
add_filter( ‘woocommerce_redirect_single_search_result’, ‘__return_false’ );
}
}, 5 );
{{/gist}}