• Resolved Garry

    (@mrgarry05)


    Hi, I have a custom field called material added with Advanced Custom Fileds (ACF) plugin. Is it possible to show the field next to product name in the search results with free or pro version of Fibosearch? such as:

    Fancy product name{custom filed name}

    • This topic was modified 1 year, 10 months ago by Garry.
    • This topic was modified 1 year, 10 months ago by Garry.
    • This topic was modified 1 year, 10 months ago by Garry.
Viewing 1 replies (of 1 total)
  • Plugin Support Kris

    (@c0nst)

    Hi @mrgarry05

    You can use this code snippet:

    add_filter( 'dgwt/wcas/search_results/products', function ( $r, $product ) {
    	if ( function_exists( 'get_field' ) ) {
    		$acf_value = get_field( 'material', $r['post_id'] );
    		if ( ! empty( $acf_value ) ) {
    			$r['value'] .= ' - ' . $acf_value;
    		}
    	}
    
    	return $r;
    }, 10, 2 );

    You have two ways to add this code to your theme:
    Open the functions.php in your child theme and add the code at the end.
    or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    • This reply was modified 1 year, 10 months ago by Kris.
Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible to include cusotm filed in the search results’ is closed to new replies.