Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Last active September 14, 2019 08:40
Show Gist options
  • Save nayemDevs/6fc170d3eed36889cf89b64cbdb73b06 to your computer and use it in GitHub Desktop.
Save nayemDevs/6fc170d3eed36889cf89b64cbdb73b06 to your computer and use it in GitHub Desktop.
adding sold by option on the single product page
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'] ) ) { ?>
<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