WooCommerce questions are off-topic, but since reviews are merely comments, I think we can make the case that ordering comments is still on-topic.
wp_list_comments()
has a reverse_top_level
parameter that will set the most recent comment first and then go backwards. Assuming it works like I think it should then you’d want to add this parameter to WooCommerce’s wp_list_comments()
.
Conveniently, a filter is available for the wp_list_comments()
args that are used in the single-product-reviews.php
template.
<ol class="commentlist">
<?php wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) ); ?>
</ol>
So, then to filter in new args, the process of filtering is the same as usual:
function wpa_filter_list_comments($args){
$args['reverse_top_level'] = true;
return $args;
}
add_filter( 'woocommerce_product_review_list_args', 'wpa_filter_list_comments' );