WooCommerce – Display Newest Product Reviews First

With more than 1 million people using WooCommerce, it is one of the most-widely-used eCommerce solutions available. And, really the only viable option for most WordPress users. I love WooCommerce and have developed many eCommerce shops both for myself and clients.

Reviews are a proven way of making your products social proof and generating more sales, and for the most part, the built-in WooCommerce review system is pretty solid. One thing I really don’t like about the built-in review system, though, is that there is no easy way to display reviews in reverse chronological orders so that the newest ones appear first on your product pages, with older reviews at the bottom. More than that, there is not a lot of good documentation on how to accomplish this without installing a plugin. Well, it seems that the solution is actually pretty simple.

If you take a peek at the single_product_review.php file in your WooCommerce plugin folder, you’ll notice that the arguments passed to display the comments are filtered. If you add the reverse_top_level argument, the display order of the comments will be reversed (so that the newer ones show up first instead of at the bottom of the list.)

You could just copy the template file to your child theme’s WooCommerce folder. But, it’s probably a lot easier to add the short code snippet you need to your functions.php file or a snippet plugin. The code is really simple, so here it is:

// show new product reviews first
add_filter( 'woocommerce_product_review_list_args', 'new_reviews_first' );
function new_reviews_first($args) {
    $args['reverse_top_level'] = true;
    return $args;
}

And, that’s it. After you plug the code into your functions.php file, your WooCommerce reviews will display in reverse order. Newer ones on top and older ones at the bottom. Try it and let me know how it works out for you.

Until next time…

Jeff

Join the Discussion