Aller au contenu
FR

Display the number of Dokan vendors- Statistics

Version audio de cet article

We will display the number of vendors from the Dokan Multivendor plugin. Vendors can sign up to websites using this plugin.

Vendors need to activate their Dokan Multivendor online store. In order to do so, I recommend creating a query displaying the number of vendors that have activated their online store.

Dokan Multivendor has multiple User Metas including one called dokan_enable_selling which displays yes or no for their online store activation.

function woocl_total_count_members_seeling_status($status) {	
	global $wpdb;
	$count = $wpdb->get_var( $wpdb->prepare(
		"SELECT COUNT(*) FROM $wpdb->users
		LEFT JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id
		WHERE meta_key = 'dokan_enable_selling'
		AND meta_value = '$status';"
	, $level ));
	return $count;
}

Display the number of vendors - Activated online stores.

You can choose yes or no.

<?php echo woocl_total_count_members_seeling_status('yes'); ?>