I'm facing a problem for making a facility in WooCommerce shop page. I'm using Dokan plugin and we have some vendors. I want to create a pop-up button on each cart of product and when a user click on it a pop-up shows some info from the seller of this product including rates and name, please help me if you can. The pop-up button could be the seller avatar.
We tried some different answers code, but all of them shows data only for the first product in the list.
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 );
$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
}
}
Reference:
How To Show Store Name On The Product Thumbnail In Dokan Multivendor Plugin by weDevs