Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Last active January 31, 2019 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayemDevs/dbc62678046d967ef326ba3712aa4b38 to your computer and use it in GitHub Desktop.
Save nayemDevs/dbc62678046d967ef326ba3712aa4b38 to your computer and use it in GitHub Desktop.
/*
Show Seller 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 );
$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>', dokan_get_store_url( $author->ID ), $author->display_name ); ?>
</span>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment