• Resolved tarynli

    (@tarynli)


    Hi

    please help!

    Is there a way to display the vendor’s reviews (shown by default on the vendor store page tabs) on the WooCommerce single product page tabs (under a tab called “vendor reviews” ?

    I have already created the new tab, but don’t know how to display the vendors reviews there.

    I added the ratings into woocommerce_single_product_summary, using
    <?php echo wp_kses_post( dokan_get_readable_seller_rating( $author->ID ) ); ?>

    but can’t get the reviews to display properly in the tab.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tarynli

    (@tarynli)

    Im will need to do this via the child-theme functions.php. Tx!

    Hello @tarynli ,

    Please use the code below to show the store reviews in a tab of single product page –

    /**
     * Add a custom product data tab
     */
    add_filter( 'woocommerce_product_tabs', 'dokan_seller_review_tab' );
    function dokan_seller_review_tab( $tabs ) {
        // Adds the new tab
        $tabs['seller_review'] = array(
            'title'     => __( 'Store reviews', 'woocommerce' ),
            'priority'  => 50,
            'callback'  => 'dokan_seller_review_tab_content'
        );
    
        return $tabs;
    
    }
    function dokan_seller_review_tab_content() {
    
        $DSR_View = DSR_View::init();
    
        // The new tab content
        $args = array(
                'post_type'   => 'dokan_store_reviews',
                'meta_key'    => 'store_id',
                'meta_value'  => $seller_id,
                'author'      => get_current_user_id(),
                'post_status' => 'publish'
            );
    
            $query = new WP_Query( $args );
            ob_start();
    
            if ( $query->posts ) {
            ?>
                <ul class="commentlist" id="dokan-store-review-single">
                    <?php echo $DSR_View->render_review_list( $query->posts, __( 'No Reviews found', 'dokan' ) );?>
                </ul>
            <?php
    
            } else {
                $DSR_View->render_add_review_button( $seller_id );
            }
        
    }

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dokan pro – display vendor reviews on single product page’ is closed to new replies.