I am customizing a product page in Woocommerce and I would like to show 5 last reviews, and then a button with all reviews of the product and the possibility to add a review.
I have this code to put all comments/reviews, but I just want to show 5:
<?php $args = array ('post_type' => 'product'); $comments = get_comments( $args ); wp_list_comments( array( 'callback' => 'woocommerce_comments' ), $comments); ?>
I know the existence of woocommerce_output_product_data_tabs(); hook, which I can use it to show everything.
Source: Ask PHP