Last active
September 14, 2019 08:40
-
-
Save nayemDevs/6fc170d3eed36889cf89b64cbdb73b06 to your computer and use it in GitHub Desktop.
adding sold by option on the single product page
This file contains 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
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