NB: Make sure you do a back up of your theme, files and database before attempting the tutorials
Last modified : Mar 25 2022
Estimated reading time : 1 minute, 4 seconds - 88 words
Share the post "Display the number of Dokan vendors- Statistics"
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'); ?>