Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Michael Cain
PLUS
Michael Cain
Courses Plus Student 16,547 Points

woocommerce reviews - move out of tabs and to bottom of the product page

Hi,

I'm making a custom theme with woocommerce in wordpress and I've got it looking great. One thing I need to do to complete it is remove the reviews from the default tabs and add move them to the bottom of the product page.

I've successfully removed reviews from the tabs using functions.php but I can't get it to add the reviews properly.

I created a custom function to re-add the reviews:

function woocommerce_template_product_reviews() {
woocommerce_get_template( 'single-product-reviews.php' );
}
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_template_product_reviews', 50 );

which adds the reviews form in the right place, but the problem I have is that it is saying there are no reviews, when in fact there is one test review in the system which has been approved.

I double checked by testing it with the reviews in tabs, which works fine.

Can anyone suggest a way around this?

alt review

4 Answers

Michael Cain
PLUS
Michael Cain
Courses Plus Student 16,547 Points

I fixed it!

add_action( 'woocommerce_after_single_product_summary', 'comments_template', 50 );
Stanley Thijssen
Stanley Thijssen
22,831 Points

Hi Michael,

How did you remove the reviews from the other hook?

Michael Cain
PLUS
Michael Cain
Courses Plus Student 16,547 Points

Hi Stanley,

I used this function (I also removed additional information tab as I wanted some custom tabs, using a plugin)...

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
    unset( $tabs['reviews'] );  // Removes the reviews tab
    unset( $tabs['additional_information'] );  // Removes the additional information tab
    return $tabs;
}