Suggestions customizations
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Hi,
I am using “Suggestions” with the search box at the front-end. It is displaying properly when user starts typing in the keyword.
Now, I want the customize the data showing in the suggestions box. Please explain how to replace WooCommerce pricing with custom pricing and change the template with twig.
Thanks
ASIF
You can find a full example in the plugin’s root folder “wpsolr-examples”.
use wpsolr\core\classes\WPSOLR_Events;
// Add/update some extra data to be shown in your local template
add_filter( WPSOLR_Events::WPSOLR_ACTION_BEFORE_RENDER_TEMPLATE, function ( $template_params ) {
// Prefix all results titles
foreach ( $template_params['template_data']['results'] as $post_type => &$result ) {
foreach ( $result['items'] as &$item ) {
$item['title']['title'] = '$$$ ' . $item['title']['title'];
}
}
});
Then copy all suggestions twig templates in your child theme, and modify them to show your custom data.
You must be logged in to reply to this topic.