• Resolved aubreyburkhart

    (@aubreyburkhart)


    Hello. I have Dokan Pro, with the Vendor Review module. I added the following code from a Dokan forum to place a vendor review tab, along with the review, on the vendor’s product pages.

    However, one vendor received a review and now that review is showing up under every product – regardless of who the vendor is. Can you please help so that the reviews only show on that vendor’s product pages?

    /**
     * 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'     => __( 'Seller 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 );
            }
        
    }
    • This topic was modified 2 years ago by aubreyburkhart. Reason: Added that I have Dokan Pro
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Vendor Review on Product Page Tab’ is closed to new replies.