ADD review start on product grid by default
-
Hi,
How can I add review starts by default (I don’t have reviews, to be grey) for products grid which don’t have reviews.
Attachments:
You must be
logged in to view attached files.
I’m using this code to display rating option if the product does not any rating and reviews like all stars in grey color in order to give rating in child theme -> functions.php
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
add_action('et_after_shop_loop_title', 'get_star_rating' );
function get_star_rating()
{
global $woocommerce, $product;
$average = $product->get_average_rating();
echo '<div class="star-rating"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' ).'</span></div>';
}
but still i’m not able to see the review grey starts.
Hello,
You don’t need to add any code. Please Go to Theme Settings >> Products Archive >> Product Styles and enable the option.
Screenshot: https://gyazo.com/bcfc21674f277b8a5786c560def4a127
Best Regards