FacetWP – only include product titles in Autocomplete facet

mgibbs189

{{gist file=”test.php” lang=”php”}}
<?php

function fwp_index_product_titles( $params, $class ) {
if ( ‘my_autocomplete’ == $params[‘facet_name’] ) {
$post_id = (int) $params[‘post_id’];
if ( ‘product’ != get_post_type( $post_id ) ) {
return false; // do not index
}
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘fwp_index_product_titles’, 10, 2 );
{{/gist}}