We created a plugin for Yotpo & Elementor!
Incredible but true, isn't it?
Indeed, if you use the plugin to leave YotPo reviews on your WooCommerce online store & you have formatted your product sheets with Elementor, you cannot display the star rating of the reviews collected for your product.
It’s still problematic and especially stupid for a plugin that is so practical !
The solution to display star rating
To display the number of reviews as in this screenshot, you will have to add code to your functions.php file of your child theme (if you don’t have a child theme you should be able to do it via a plugin that injects code) and then you just have to place a shortcode anywhere on a product page 🙂
Add this code
You will add this code in your functions.php after your content.
// Shortcode who allow you to display the YotPo stars rating where you want on an elementor product template.
// Simply add a shortcode elementor widget and add the shortcode [wycan_yotpo_stars_rating]
function wycan_yotpo_stars_single( $atts ) {
if ( function_exists( 'wc_yotpo_show_buttomline' ) )
{ add_action( 'woocommerce_single_product_summary', 'wc_yotpo_show_buttomline', 15 ); }
}
add_shortcode( 'wycan_yotpo_stars_rating', 'wc_yotpo_show_buttomline');
Once done, you will add a Shortcode widget to your Elementor product template.
Then, you will enter the shortcode, as in the screenshot opposite: [wycan_yotpo_stars_rating]
All you have to do is place the widget where you want on the design of your Elementor product page 🙂
Add the reviews widget where you want
Now that you have put where you want the stars for the rating, you will want to add the space where the comments/reviews will be posted.
To do this, you just have to copy paste this code and add it to your functions.php in your child theme then as in the previous step, insert the shortcode in your unique product design template: [wycan_yotpo_reviews_rating]
// Add the reviews area inside a single product template with elementor, simply add the shortcode widget with [wycan_yotpo_reviews_rating]//
function wycan_yotpo_reviews_single( $atts ) {
if ( function_exists( 'wc_yotpo_show_widget' ) ){
add_action( 'woocommerce_after_single_product', 'wc_yotpo_show_widget', 15 ); }
}
add_shortcode( 'wycan_yotpo_reviews_rating', 'wc_yotpo_show_widget');