Reply 243107 to: "Sold by [shop name]" not vendor name

Avatar: John Holden
John Holden
Support staff
July 3, 2020 at 12:36

Hi,

To show it you just need to add the following code to child theme functions.php

add_action( 'woocommerce_after_shop_loop_item_title','sold_by' );
function sold_by(){
        global $product;
        $seller = get_post_field( 'post_author', $product->get_id());
        $author  = get_user_by( 'id', $seller );
        $vendor = dokan()->vendor->get( $seller );

        $store_info = dokan_get_store_info( $author->ID );
        if ( !empty( $store_info['store_name'] ) ) { ?>
                <span class="details">
                    <?php printf( 'Sold by: <a href="%s">%s</a>', $vendor->get_shop_url(),  $vendor->get_shop_name() ); ?>
                </span>
        <?php 
    } 
}

Regards,
Hung PD

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.