Update.
I Figured out how to add all categories. Code below. But how do you add a specific category. For example, I want to only show the categories in “color”?
Function.php
add_filter( 'dgwt/wcas/tnt/indexer/readable/product/data', function ( $data, $product_id, $product ) {
$term = $product->getTerms( 'product_cat', 'string' );
if ( ! empty( $term ) ) {
$html = '<span class="searchcategories">';
$html .= $term;
$html .= '</span>';
$data['meta']['product_cat'] = $html;
}
return $data;
}, 10, 3 );
fibosearch.php added in child theme root (reindex after adding):
add_filter( 'dgwt/wcas/tnt/search_results/suggestion/product', function ( $data, $suggestion ) {
if ( ! empty( $suggestion->meta['product_cat'] ) ) {
$html = '<div class="searchcategories">';
$html .= $suggestion->meta['product_cat'];
$html .= '</div>';
$data['content_after'] = $html;
}
return $data;
}, 10, 2 );