WooCommerce Show Review Rating Count On Product Archive

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

Do you know what’s really misleading? When you are comparing two products on the archive page and you’re weighing up the reviews. You notice Product A is rated 5 stars and Product B is only rated 4 stars…the decision is easy right? Well, what if Product A only had 2 reviews and Product B had 100 reviews? The review rating count is likely to sway the customer’s decision. This snippet will out the number of reviews a product has on the product archive loop items.

				
					/**
 * Snippet Name:	WooCommerce Show Review Rating Count On Product Archive
 * Snippet Author:	ecommercehints.com
 */

add_filter( 'woocommerce_product_get_rating_html', 'ecommercehints_show_rating_count_on_product_archive', 20, 3 );
function ecommercehints_show_rating_count_on_product_archive( $html, $rating, $count ) {
	global $product;
	$rating_count = $product->get_rating_count();
	if (is_product_category() || is_shop()) {
		if ($rating_count == 1) {
			$html .= "<div class='ecommercehints_rating_count'>(" . $product->get_rating_count() . " Review)</div>";
		} else {
			$html .= "<div class='ecommercehints_rating_count'>(" . $product->get_rating_count() . " Reviews)</div>";	
		}
	}
	return $html;
}
				
			

Snippet Benefits

  • Show the number of product reviews (rating count) on the product archive loop items.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

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

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers