Woocommerce always show stars – even with no reviews

Spread the love

Woocommerce Star Rating : – All items should show rating stars notwithstanding when there are no reviews yet.
Discovered this bit and it works extraordinarily in my shop circle, modules, and tweaked topics.
Many developers who has been looking for this, here is the solutions for them, please take a look.
this works fine with the woocommerce.
Below is the code

// always display rating stars
function filter_woocommerce_product_get_rating_html( $rating_html, $rating, $count ) {
$rating_html = '
<div class="star-rating">';
$rating_html .= wc_get_star_rating_html( $rating, $count );
$rating_html .= '</div>
return $rating_html;
add_filter( 'woocommerce_product_get_rating_html', 'filter_woocommerce_product_get_rating_html', 10, 3 );

How to use this code ?

Step 1: if you are not using child theme, then create a child theme first.

Step 2.: Go the the root of your child theme and create or copy funtction,php inside the child theme folder. (To copy function.php, you will have to copy this file from you main theme root directory.)

Step 3: Simply add the above code into your child theme function.php file and save it.

Finally you can see Products are displaying star rating even products are unrated by the user.

if any issue comment below, Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

WP Twitter Auto Publish Powered By : XYZScripts.com