By default, woocommerce product reviews are listed in chronological order. How do you get the newest review to appear first?
1 Answer
I couldn’t find this documented anywhere, but the solution is pretty simple.
In single_product_review.php
, the arguments passed to wp_list_comments are filtered:
wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) );
by adding reverse_top_level
to the arguments, the order is reversed.
Add the following code to your theme’s functions.php:
// show newest product reviews on top
add_filter( 'woocommerce_product_review_list_args', 'newest_reviews_first' );
function newest_reviews_first($args) {
$args['reverse_top_level'] = true;
return $args;
}