Last active
April 26, 2022 16:11
-
-
Save nayemDevs/6d0f1ff033c6ba6f90e777110be17bbd to your computer and use it in GitHub Desktop.
Show Store name on product thumbnail instead of vendor name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Show Store name on the product thumbnail For Dokan Multivendor plugin | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item_title','sold_by' ); | |
function sold_by(){ | |
?> | |
</a> | |
<?php | |
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 | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for the code! It works great. How can i center the Text? And is it possible to add more information there with custom fields i added in the vendors profile?