Custom widget placement | Judge.me

Custom widget placement

1. Move review widget to the product's tabs

Add the following code to your theme's functions.php:

if (class_exists( 'JudgeMe' )) {
    add_action( 'init', 'jgm_remove_review_widget' );

    function jgm_remove_review_widget () {
        // Remove the default widget placement
        remove_action( 'woocommerce_after_single_product_summary', array( 'JGM_Widget', 'judgeme_review_widget' ), 14 );
    }

     add_filter( 'woocommerce_product_tabs', 'jgm_add_review__widget_to_tab' );

     function jgm_add_review__widget_to_tab ($tabs) {
         $tabs['judgeme_reviews'] = array(
            'title' => __( 'Reviews', 'woocommerce' ),
            'priority' => 50,
            'callback' => array( 'JGM_Widget', 'judgeme_review_widget' )
         );

         return $tabs;
     }
}