How to have a whole number ratings in WP Product Review

If you want to display final review ratings in whole number like this:

instead of the ones with the decimal points like this:

Add the following code snippet to your theme's function.php file: 

function change_wppr_rating( $rating, $id, $model ) {
	$new_rating = round( $rating / 10 );
	return $new_rating * 10;
}

add_filter( 'wppr_rating', 'change_wppr_rating', 10 );

Save the file, and you'll see all your review ratings will be whole number.

NOTE: We strongly recommend using a child theme while adding this to function.php as it won't break the function over the updates. Here is tutorial on how you can create a child theme.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.