Every marketplace owner always looks for making their website more user-friendly. They want to save their customer’s time.
I am getting the below question from many users to add vendor name with Store URL on the product thumbnail:
Hi!
I want to display the vendor’s name alongside the Product name and price on the shop page (the thumbnails of products). Can you help?
How to add vendor name on the product thumbnail?
If you are using Dokan plugin and if You can easily add the vendor name with the Store URL on the product thumbnail by adding some custom codes in your child theme. On the thumbnail, it can be shown like below-

Now, if you click on the vendor name then it will redirect you to the vendor store page. If you are looking for the same thing then add the below code in your child theme’s functions.php file –
I believe the above code snippet will help you and if you need to modify anything then you can change it as per your requirement.
Important Note
If you need to show store name instead of vendor name then you have to use below codes and do not copy the first line and the last line with <?php and ?>
0 thoughts on “How To Show Vendor Name On The Product Thumbnail In Dokan Multivendor Plugin by weDevs”
Hi,
thanks for this but it didn’t work for me
Any help sir
Hello,
It depends on how you inserted the code. For me, it is still working. Kindly make sure if you are not doing any mistake.
It’s not working for me too.
I am using the electro child theme
I am using the electro child theme. I have inserted this code in the functions.php file in the child theme. But not working.
Hello,
It can be for your theme. Each theme does not use the same function for the product thumbnail. Kindly check with a default theme and let me know the update.
Hi
Did you ever find the right code for electro theme Sharif?
thanks
Hi David/Sharif.
I am also using the electro theme and would love for this code to work. Did you find a solution?
Fiona
im receiving this error:
Uncaught Error: Call to a member function get_id() on null in wp-content/themes/alpha-store-pro-updated-child/functions.php:245
Stack trace:
thanks in advance for any help you might provide.
The code is working fine on my local server. Kindly check correctly if you have inserted everything correctly or not 🙂
when i copy and paste that code directly into my functions.php without making and changes i receive this error:
Your PHP code changes were rolled back due to an error on line 259 of file wp-content/themes/alpha-store-pro-updated-child/functions.php. Please fix and try saving again.
syntax error, unexpected ‘}’, expecting end of file
i tried replacing the last ‘}’ with ?> and then i received this error:
Your PHP code changes were rolled back due to an error on line 248 of file wp-content/themes/alpha-store-pro-updated-child/functions.php. Please fix and try saving again.
Uncaught Error: Call to a member function get_id() on null in wp-content/themes/alpha-store-pro-updated-child/functions.php:248
Stack trace:
#0 wp-settings.php(424): include()
#1 wp-config.php(79): require_once(‘/home/stufffor/…’)
#2 wp-load.php(37): require_once(‘/home/stufffor/…’)
#3 wp-admin/admin.php(31): require_once(‘/home/stufffor/…’)
#4 wp-admin/theme-editor.php(10): require_once(‘/home/stufffor/…’)
#5 {main}
thrown
also please note that i used the other code you provided for adding the vendor name to the single product page and that one worked perfectly! thanks again for all your help i really appreciate it. these are really cool features to add to the shop. just hope i can get this thumbnails one working as well. thanks!
Please note that you are missing “}” which was closing for the function. Kindly check the code in RAW mode. I just checked the code again and its working fine.
add_action( 'woocommerce_after_shop_loop_item_title','sold_by' );
function sold_by(){
?>
get_id());
$author = get_user_by( 'id', $seller );
$store_info = dokan_get_store_info( $author->ID );
if ( !empty( $store_info['store_name'] ) ) { ?>
%s', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
Hello. I get this error
Uncaught Error: Call to undefined function dokan_get_store_info() in wp-content/themes/xstore-child/functions.php:244
How can solve this.
Hello. I get this error
Uncaught Error: Call to undefined function dokan_get_store_info() in wp-content/themes/xstore-child/functions.php:244
How can solve this.
Did you install Dokan plugin? If yes, then make sure that you have inserted the code correctly or your theme does not have the same function called.
Hi,
Whenever I change line 18 to this code: <?php printf( 'Sold by: %s‘, $vendor->get_shop_url(), $vendor->get_shop_name() ); ?>, the website keep loading non stop. When I change it back to original, everything fine. Any possible way to show vendors name instead of seller name?
It should work fine. However, this blog was written a year ago and if the code is not working then you may need to modify 🙂 Which theme are you using?
Hello,
I have updated the post 🙂 Kindly re-check!
So the code that works for store is this right?, I’m not programmer at all, I just want to be sure, I have to copy and past the code from that php start until the end as it is and is going to work? because the last time it broke my site
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( 'Sold by: %s‘, $vendor->get_shop_url(), $vendor->get_shop_name() ); ?>
I checked twice and it works 🙂
i checked and it works fine, i would like to know how to add the geolocation town / city to thumbnail too?
It’s not easy to add but you need to print the location value on the same filter I used here.
1. How do I give vendors permission to edit products that have been previously published by the admin?
2. Is there a way to change permissions so that the vendor can edit, but not publish, the product directly?
thanks.
I want the sellers’ photos to appear on the product page next to their names
Hello,
Yes, it is possible to just you have to also get their profile image like $profile_info[‘store_ppp’]
Please display the seller’s photo code below all products
Put it here for me to copy
thank
Hello @fariborz,
I write blogs for free and to help people and I tried my best to write which was a most demanded functionality. The photo image is not so demanded and I am unable to do the full code now as I don’t have enough time. I can understand but I have provided the way how you can do it 🙂
Hi, Thank you very much for the info…
I dare to ask here because I can’t find any other reference…
The usecase: In the theme functions.php I am looping through all the products checking if vendor has saved all data necessary. (The idea is to make it a cronjob)
But then: I get this stupid error (below) and no idea why…
the function: dokan_get_store_info resolves to dokan()->vendor->get($id)->get_store_info();
I tried both ways but both times it gives me the same error and apparently dokan()->vendor is null (I finer checked and dokan() is something but vendor is null). No clue…
Any experience value or hint where to point?
The query is a simple: new WP_Query( array(
‘post_type’ => ‘product’,
‘posts_per_page’ => -1,
));
then I get product->id => post => author and try to get the store_info from the author, but I stuble upon this null issue
PHP Fatal error: Uncaught Error: Call to a member function get() on null in /home/tienda40/public_html/wp-content/plugins/dokan-lite/includes/functions.php:1191
Stack trace:
#0 /home/tienda40/public_html/wp-content/themes/martfury-child/functions.php(545): dokan_get_store_info(’26’)
[23-Apr-2020 21:10:48 UTC] PHP Fatal error: Uncaught Error: Call to a member function get() on null in /home/tienda40/public_html/wp-content/plugins/dokan-lite/includes/functions.php:1191
Stack trace:
#0 /home/tienda40/public_html/wp-content/themes/martfury-child/functions.php(546): dokan_get_store_info(26)
Where in functions.php file should code be copied and pasted? Beginning or end?
Along with profile image, can you also add in the vendor store short description as well next to profile and vendor profile image?
You need to place the code on the bottom of your functions.php file. Also, if you need to show any other store info then you can just print that value as like the store name 🙂
How can I get next to the store name, the profile picture or avatar of the same store?
You have to print the other value for store profile picture like store_ppp();
I am using Dokan with divi theme. Added the code snippet to get the vendor name and it is working fine.
But when I click the vendor name, it redirects me to the vendor store page where I get the following error –
Warning: in array() in parameter 2 to be array, null given in /home/customer/www/hobbi.fun/public_html/wp-includes/nav-menu-template.php
Also, can i redirect this to a different page instead of the vendor store (this page will be different for every vendor)
Code works as of December’20 because i just added it and it shows up just as expected.
I took it one step further, adding in vendor avatar beside the label sold by,
just add this line in front of the ” ”
<img src="get_avatar() ); ?>” alt=”get_shop_name() ); ?>”
Hi thank you for the code. I was able to make the change and display sold by store name. However, after applying your code, I have two sold by labels in my dokan theme. One of them displays the Store Name while the other displays my Website’s Title. Ideally, I only want to display one Sold By label along with my Store’s name. Can you please help me to resolve the issue? Here’s my url: http://ohq.cfc.myftpupload.com/
I am not seeing the code on your site now. However, if you have inserted the right code then it should not appear twice but make sure that you have added the code once only 🙂
how can i do separate payment system. COD for customers & online payment for vendor subscription.
hello @Nayem
thanks so much for your wonderful posts, i made my product thumbnail using elementor ( jet woo templets ) i tried to do it throw the shortcode method but unfortunately i get errors ….. I would be so grateful if you could help me out with this here what i am trying to do . i want to display the vendor name along with his picture and there store reviews
Hello,
What kind of error are you getting? If you have placed the code correctly then everything should work fine.
thank you so much for your follow up i just figured it out my self . it was all because jet engine made the defualt widget render method as micros i changed that to elememntor default and now works flowless . here is the code i used for displaying vendor ratings
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 );
echo wp_kses_post( dokan_get_readable_seller_rating( $author->ID ) ); ?>
Hi,
thank you so much
I use Flatsome theme
How do I put Sold By in a custom place
I want to put this in product sidebar.
Hi i need a custom dokan code that display my vendors location(address) over my woocommerce product. is that possible?
I want to show State field instead of Vender Store Name. Please
Hello I have a relative question on how to display a vendor’s phone number in to product page and in a single product, which also has a capability to make phone calls.
Can you help?
Thanks you. This worked for me. So happy after asking around for months
This worked great. Do you know how I can add the store City and State info as well to the product page?
You have to print the other address meta which will require a few more lines of code.
please write and share this code for us. thanks
Hello, nayemdevs. this is good tutorial. but I want to ask. If I want to add order number with vendor store name. Example: Order number is “24527” and Store name is “Nayem Shop”. and then order number become to “24527-Nayem Shop”. how to add that in function?
Hi,
i am using dokan and electro theme but at h panel is ee only electro not a child theme where should i get it ?
Hi this is working perfectly fine. How can I move the name of the vendor on top of the price?
Hi
Thank you for this code it worked great but on just the store page
is there away I can apply it for every product thumbnail not only on the store page
as I have product displayed on other pages.
Thank you