"Sold by [shop name]" not vendor name

This topic has 4 replies, 3 voices, and was last updated 4 years, 5 months ago ago by Olga Barlow

  • Avatar: Nick
    Nick
    Participant
    July 3, 2020 at 12:14

    Hi,
    Currently my shop displays the product saying “sold by [vendor name].
    How do i change it so that is displays “sold by [shop name]”.?

    3 Answers
    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

    Avatar: Nick
    Nick
    Participant
    July 3, 2020 at 19:48

    Hi Hung,

    i put the code into xstore child theme but nothing changed.
    just to clarify, i would like it to show the shop name.
    currently its still showing the seller name.

    please provide alternative solution thanks.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    July 6, 2020 at 14:26

    Hello,

    Could you, please, provide us with temporary WP Dashboard and FTP access to your site to check and help you?

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.