dokan vendor name

Show vendor name on the single product page – Dokan Multivendor Plugin

Are you a Dokan Multivendor plugin user? If yes, then this tips can help you a lot. In another post of mine, I have described that how you can show vendor store name on product thumbnail. After publishing the post I got many requests to write another post at a similar point but this time the vendor name needs to show on the single product page.

To promote the vendor or to inform the customer about the vendor, the site admin always try to show the original owner of the product. On the single product page, there is a tab called “Vendor Information” to show vendor address, email etc. Nowadays, no one has the time to check each tab because everyone wants to save their time.

You are also thinking to add an option to the single product page description where the customer can view the original vendor who is selling the product. You are thinking to add an option to show  “Sold by: [store name]” on the single product page under the product summary.

How to show sold by tag on the single product page?

I found a quick solution to show vendor store name on the single product page. It is really quick and easy solution. Just open your child-theme functions.php file and add the below code :

After saving the file, just reload the single product page and you will be able to see the vendor store name on the single product page under the product summary.

I believe that this small tips can help you a lot. If you are not using Dokan plugin then you can take a look here.

Video Tutorial

Important Note

If you want to show Store name Instead of Vendor name then use the below code rather than the above one.

If you have built your single product page with Elementor then you need to use below code

Just add the code on your child-theme functions.php and use the shortcode [dokan_vendor_name] through the short-code widget on single product page

Share This Post

Related Post

0 thoughts on “Show vendor name on the single product page – Dokan Multivendor Plugin

    1. Note: If you need to show store name instead of vendor name then you can replace the line number 18 with this line- 

      %s‘, $vendor->get_shop_url(), $vendor->get_shop_name() ); ?>

      1. Hi,

        I added this line, but it didn’t work, it shown “get_shop_url(), $vendor->get_shop_name() ); ?>” this line at the single product page. Is it something missing in this code?

        Thanks in advance.

      1. If its not that hard or time consuming for you, could you help me?
        Or send me a quote to my email and we can talk about this.

        I’m afraid Im a donkey looking at a palace when it comes to this stuff.

          1. Hello brother
            I’ve been trying for week now to insert both codes but it’s not working I’m using Flatsome theme and Dokan plugins and I try to show vendor store name
            Can you help if I share you the site access please

          2. Hello,

            It should work fine if you have inserted it correctly. Kindly send an email via my contact form with your details. I will check in my free time.

    1. It is possible but this is a totally different requirement rather than this blog topic. You have to add a button and then you have to get the store URL for the button 🙂

  1. Hello,

    Really appreciate what you’ve shown us! Is there a way however to not show the above for specific vendor? I.e for the website owner?

  2. Your codes look great, but all codes I implement in the functions.php result in my website stating: “the website is dealing with technical problems”

    What am I doing wrong?

    1. Hello,

      Kindly make sure that you have inserted the code correctly and you did not miss any syntax. Also, if you can then turn on your debug to view the error.

  3. What I am doing wrong? I have copied the code in my php plugin (my-custom-functions) and all the time it brokes the page, I copy from 1 to the 18 but is still broken, what I’m doing wrong?

      1. Thank you so much, that was the reason why, so I think most of the people with problems is that they copy and paste the full code as you advised, but it should be just this:

        /*Show store name on single product*/
        add_action( ‘woocommerce_single_product_summary’, ‘seller_name_on_single’, 12 );
        function seller_name_on_single(){
        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’] ) ) { ?>

        <?php printf( 'Vendido Por: %s‘, $vendor->get_shop_url(), $vendor->get_shop_name() ); ?>

        <?php
        }
        }

          1. When I try to use this code it does not work….It show on my frontend but my back end refuse to open…telling me there is an error on so so line

          1. I’m doing it right now cause it has been amazing, I love the way it looks now my site is:

            https://migrankiosko.com/producto/playstation-plus-membresia-de-3-meses-codigo-digital/

            I changed the word “Sold by:” to “Vendido Por:” cause I needed it in spanish, which looks amazing now.

            Hey I’m not sure if you can help me out with a thing inside Dokan, when a vendors creates a bulk discount it only shows the percentage, but most of the vendors will like an amount discount that a percentage, is there a way that can be done?

            Thanks

  4. Thank you for your help! I’d like to Show Vendor Name On The Single Product Page,
    but ABOVE the title of the product!

    Can you help me with the proper hook?

    THANKS SO MUCH!

  5. Hi!
    I’m using a custom single product template created using JetWooBuilder + Elementor.
    I tried adding this code to child functions.php – Didn’t work
    I tried creating a shortcode for the php code and inserting the shortcode into the Elementor template – Didn’t work as well.

    Do you have any idea on how to get this working on Elementor single product template? I think we can also try using dynamic terms with elementor.

    Please give your suggestions.

  6. Is it possible to add something like a verification icon after verified vendor’s name, i mean something like verified Twitter handle, anywhere the name of the vendor appears?

      1. Hello,

        I would like to add city vendor name on single product page do you know how to do this ?

  7. How ca I show the vendor biography in my single product tab “Vendor Information”?

      1. function dokan_order_show_suborders( $parent_order ) {
        $sub_orders = get_children(
        [
        ‘post_parent’ => dokan_get_prop( $parent_order, ‘id’ ),
        ‘post_type’ => ‘shop_order’,
        ‘post_status’ => [
        ‘wc-pending’,
        ‘wc-completed’,
        ‘wc-processing’,
        ‘wc-on-hold’,
        ‘wc-cancelled’,
        ],
        ]
        );

        if ( ! $sub_orders ) {
        return;
        }

        $statuses = wc_get_order_statuses();

        dokan_get_template_part(
        ‘sub-orders’,
        ”,
        [
        ‘sub_orders’ => $sub_orders,
        ‘statuses’ => $statuses,
        ]
        );
        }

        How to display phone numberr in this code ?

  8. It is Possible to change de “Vendor info# in the tab of single page product? I need the info of the store (phone number, emai, vendor nade) Please healp me with the code. Im a rocky.

  9. I can’t seem to get the code to work when I copy and paste into functions.php file. I am using the astra stock theme and have created single product pages with elementor. When I paste code + shortcode in elementor, it appears to be disconnected as all it says after refreshing is “[dokan_vendor_name]”. Any thoughts on how to fix? Is it the theme?

    1. Hi There – Just wanted to see if you had any thoughts on why the code may note be working with the astra theme?

      See prior comment as well “I can’t seem to get the code to work when I copy and paste into functions.php file. I am using the astra stock theme and have created single product pages with elementor. When I paste code + shortcode in elementor, it appears to be disconnected as all it says after refreshing is “[dokan_vendor_name]”. Any thoughts on how to fix? Is it the theme”

      1. Hello Connor,

        I am not sure why it is not working. if you can contact me with site credential then I can check and provide a fix 🙂

  10. Big thanks to Nazmul for helping me directly fix my site that now shows the sold by seller name on both my product thumbnail and single product page. He was very responsive and helpful on fixing my code issues during his spare time!

  11. Hi, just wondering if this snippet needs to be updated at all(shortcode version). I’ve updated to Elementor 3.0.X series and this snippet keeps causing my single product template to crash. Thank you.

  12. Hello. I am trying to include the seller’s biography on my product page, but have not found any code that works for me.

    I tried anyway but it is blank.

    I’m using the astra theme, and the latest version of elementor pro and dokan pro.
    My product page is made in elementor.
    Can someone help me?

  13. Hi Nayem, great code.
    Is there a way to show vendor’s name (or shop’s name) in categories page under the name of the product?

    1. If you add the name on the thumbnail then it will appear everywhere. In such case, you may need to read my other post about Show vendor name on product thumbnail 🙂

  14. thank you very much! your code worked 🙂

    I got through “dokan_vendor_bio_shortcode” for elementor.

    then, I was able to add the vendor’s biography using:

    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[‘vendor_biography’] ) ) { ?>

    get_vendor_biography() ); ?>

    <?php
    }
    }

    I used the plugin "snipped" for inser the code,and it worked
    🙂

    now I have a doubt: to insert the vendor image ( vendor profile picture ) , what code can I use?

  15. NayemDevs, thaks for your support! I have searching this tric for a while but finaly got…Now, is it posible also to display number of years dokan vender spend on our website” after vendor name?

    Eg: Admin, 2Yrs

    Thanks!

  16. Hello Nayem.

    Pls I want to get a vendor shop url and be able to display it on anypage.

    How can I go about it?

  17. I’m using this code similar to how you would with Elementor (I’m using divi). I’ve copied the code to functions.php. When I insert the shortcode, instead of placing “Sold by: Vendor” where the shortcode is, it always goes to the top, left of the page.

    Any thoughts?

  18. Hi,
    Thank you for your work. The method with the shortcode works but gives me an error 500 when saving the changes. Do you have a solution for this? Thank you

  19. Hi Bro,

    Your are awesome.. Thanks for sharing this information with us.

    One more help need from you, if you can help us.

    How to show vendor discount coupon https://prnt.sc/w3ls9d on single product page.

    Thanks again for the great blog..

    1. Thanks, I hope you will provide a review here- https://facebook.com/nayemDevs and Subscribe my youtube channel.

      To show vendor coupons on the single product page, you may need to add some custom code or maybe you can create a shortcode. However, to get all vendor coupon you can check the below code-

      $coupon_args = array(
      ‘posts_per_page’ => -1,
      ‘orderby’ => ‘title’,
      ‘order’ => ‘asc’,
      ‘post_type’ => ‘shop_coupon’,
      ‘post_status’ => ‘publish’,
      );
      $all_coupons = get_posts( $coupon_args );

  20. Hi, Thank you so much for your tutorials.

    I am trying to add an extra field as a button by returning the store(vendor) user nickname next to a link

    add_action( ‘dokan_store_header_info_fields’, ‘sold_by’, 10);

    function sold_by(){
    ?>

    ID );

    ?>

    <?php printf( 'Contact Seller‘, esc_html__( $author->user_nicename ) ); ?>

    <?php

    }

    also is there a way to add a button at the after order table ( when the Customer view the order details )

  21. Thanks for the code but unfortunately not working for me. I used below code in my function.php of child theme.

    /*
    Show Vendor/Seller on the all Single Product just above the SKU For Dokan Multivendor plugin
    */
    add_action( ‘woocommerce_single_product_summary’, ‘seller_name_on_single’, 11 );
    function seller_name_on_single(){
    global $product;
    $seller = get_post_field( ‘post_author’, $product->get_id());
    $author = get_user_by( ‘id’, $seller );

    $store_info = dokan_get_store_info( $author->ID );

    if ( !empty( $store_info[‘store_name’] ) ) { ?>

    <?php printf( 'Sold by: %s‘, dokan_get_store_url( $author->ID ), $author->display_name ); ?>

    get_id());
    $author = get_user_by( ‘id’, $seller );

    $store_info = dokan_get_store_info( $author->ID );
    if ( !empty( $store_info[‘store_name’] ) ) { ?>

    <?php printf( 'Sold by: %s‘, dokan_get_store_url( $author->ID ), $author->display_name ); ?>

    <?php
    }
    }

    Please help!

  22. Hi, I want to display the vendor name in the vendor store. I have created a custom page. I am using the Dokan Pro with Elementor Pro. But elementor author widget box is not showing the vendor name.

  23. Hi Nayem,
    Thanks again for creating code to help us all 🙂
    This one isn’t working for me (tried all 3 versions of the code).
    I’m using Astra theme.
    Many thanks,
    Karen

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: