Skip to content

Instantly share code, notes, and snippets.

@amanhstu
Last active February 15, 2018 17:01
Show Gist options
  • Save amanhstu/fd6c0ca618aa9953625ce235b41af9e4 to your computer and use it in GitHub Desktop.
Save amanhstu/fd6c0ca618aa9953625ce235b41af9e4 to your computer and use it in GitHub Desktop.
//woocommerce
/*
Show Seller name on the product thumbnail
For WooCommerce
*/
add_action( 'woocommerce_after_shop_loop_item_title','sold_by_vendor_name' );
function sold_by_vendor_name(){
?>
</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="brand-name">
<?php printf( '<a href="%s">%s</a>', dokan_get_store_url( $author->ID ), $store_info['store_name'] ); ?>
</span>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment