Hello there,
hope you are doing well!
Please, add the following code in the functions.php file of your active theme:
if (class_exists('YITH_WooCommerce_Advanced_Reviews')){
remove_action( 'ywar_summary_prepend', array( YITH_WooCommerce_Advanced_Reviews::get_instance(), 'add_reviews_average_info' ) );
if (!function_exists('yith_add_reviews_average_info_custom')){
function yith_add_reviews_average_info_custom($product){
$instance = YITH_WooCommerce_Advanced_Reviews::get_instance();
if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) {
return;
}
$product_id = yit_get_prop( $product, 'id' );
$average = $instance->get_average_rating( $product_id );
$count = count( $instance->get_product_reviews_by_rating( $product_id ) );
$rated_text = sprintf( __( 'Rated %s out of 5 stars', 'yith-woocommerce-advanced-reviews' ), esc_html( $average ) );
if ( $count > 0 ) { ?>
<div class="woocommerce-product-rating">
<div class="star-rating" title="<?php $rated_text; ?>">
<span style="width:<?php echo( ( $average / 5 ) * 100 ); ?>%">
<span class="review-rating-value"><?php echo $rated_text; ?></span>
</span>
</div>
<?php
echo $average . ' based on ';
?>
<span class="ywar_review_count"><?php printf( "%d %s", $count, _n( " review", " reviews", $count, 'yith-woocommerce-advanced-reviews' ) ); ?></span>
</div>
<?php
}
}
add_action( 'ywar_summary_prepend', 'yith_add_reviews_average_info_custom' );
}
}
Try it and let us know.
Have a nice day!
-
This reply was modified 5 years, 8 months ago by
YITHEMES.