How to sort product reviews from newest to older?

This topic has 4 replies, 2 voices, and was last updated 6 months, 1 weeks ago ago by Luca Rossi

  • Avatar: Theodoros
    Theodoros
    Participant
    April 29, 2024 at 08:33

    Hello, currently on my website the product reviews are sorted from oldest to newest, so you need to scroll down to see the most recent review. I would like to reverse the order so you can see the most recent review on top. Can you help me on how to do this?
    Thanks!

    Please, contact administrator
    for this information.
    3 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    April 29, 2024 at 18:17

    Hi @Theodoros,

    Please try adding the following code under functions.php file locates in your child theme:

    
    function wpa_filter_list_comments($args){
      $args['reverse_top_level'] = true;
      return $args;
    }
    add_filter( 'woocommerce_product_review_list_args', 'wpa_filter_list_comments' );
    

    Fore more information, please take a look at this: https://wordpress.stackexchange.com/questions/139197/sort-reviews-ratings-by-date-on-woocommerce

    Hope it helps!

    Avatar: Theodoros
    Theodoros
    Participant
    April 29, 2024 at 18:42

    This did not work, i attach a screenshot of the functions.php file

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    April 30, 2024 at 04:16

    Hi @Theodoros,

    We tried to login with this account but it didn’t work.

    Could you please check again?

    Thank you!

    Please contact administrator
    for this information.
  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.