Product Archive

WooCommerce Show Review Rating Count On Product Archive

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.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.

26027
WELCOME OFFER