Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    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 );
    
    Kris

    (@c0nst)

    Hi?@oc-wordpress-web-designer

    This support forum is only for users of the Free version of plugins.
    Because you’re asking about the Pro version, please submit a ticket via our website: https://fibosearch.com/contact/.

    Regards,
    Kris

    Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    What is the free version solution then?

    Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    What is the free version solution?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How Do You Show The Product Categories In The Autocomplete?’ is closed to new replies.