• Resolved suiluj

    (@suiluj)


    hello,

    in Germany you have to show the unit price (cost per kg for example) next to to search result.

    Could you please add an option for that?
    The unit price is saved in the product meta data if you have installed the “Germanized” plugin.

Viewing 1 replies (of 1 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Well it is possible to add any meta values inside search results.
    Please use following code snippet

    add_filter( 'aws_excerpt_search_result', 'aws_excerpt_search_result', 10, 2 );
    function aws_excerpt_search_result( $excerpt, $post_id ) {
    
        $field_name = 'some_field';
        $custom_fields = get_post_custom( $post_id );
    
        if ( $custom_fields && ! empty( $custom_fields ) && isset( $custom_fields[$field_name] ) ) {
            $excerpt = $excerpt . '<br>' . $custom_fields[$field_name][0];
        }
    
        return $excerpt;
    
    }

    change some_field to the name of custom field that you want to display

    You need to add it somewhere outside plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Also after adding this code you will need to go to the plugin settings page and click ‘Clear cache’ button.

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Show Unit price next to price’ is closed to new replies.