Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
Last active July 28, 2022 11:27
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/cf150250a995d680a2dace9daa712e64 to your computer and use it in GitHub Desktop.
Save nayemDevs/cf150250a995d680a2dace9daa712e64 to your computer and use it in GitHub Desktop.
Show store name on single product page (Sold by: vendor) when you have created single product via Elementor
/**
* Show sold by on single product page made with Elementor
* Add the shortcode [dokan_vendor_name] through a short-code widget on single product page
*/
add_shortcode( 'dokan_vendor_name', 'dokan_store_name_shortcode' );
function dokan_store_name_shortcode() {
$seller = get_post_field( 'post_author' );
$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
}
}
@akash0ahammed
Copy link

How to show vendor name in vendor dashboard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment