Rating or review stars show to the product. If we have at least a single review. But sometime, We would like to show stars to all product even we do not have a single review yet.

Here is the Snippet to show review or rating stars to all products.

// Woocommerce rating stars always
add_filter(‘woocommerce_product_get_rating_html’, ‘show_rating_html’, 10, 2);function show_rating_html($rating_html, $rating) {
if ( $rating > 0 ) {
$title = sprintf( __( ‘Rated %s out of 5’, ‘woocommerce’ ), $rating );
} else {
$title = ‘Not yet rated’;
$rating = 0;
}$rating_html = ‘

‘;
$rating_html .= ‘‘ . $rating . ‘ ‘ . __( ‘out of 5’, ‘woocommerce’ ) . ‘‘;
$rating_html .= ‘

‘;
return $rating_html;
}