Dokan
When you use Dokan – one of the most popular multivendor plugins for WooCommerce – you need to track not just which products were sold, but which vendor supplied them. This guide shows you exactly how to export vendor store names, contact details, and complete vendor addresses alongside your order data.
Whether you need to send vendor‑specific reports to your accounting team, automate commission calculations, or provide vendors with their own sales data, the code in this article gives you a clean, maintainable solution.
When to Use This Integration
The Dokan integration is essential when your reporting requires vendor attribution. Here are the most common scenarios:
|
Business Need |
How This Integration Helps |
|---|---|
|
Monthly vendor commission reports |
Export orders with vendor store names and contact details for accurate commission tracking. |
|
Fulfillment tracking by vendor |
Identify which vendor supplied each product and track fulfillment times per vendor. |
|
Customer service tickets |
Quickly see which vendor sold an item when a customer has a product‑specific issue. |
|
Vendor performance dashboards |
Aggregate order data by vendor to analyse sales volume, refund rates, and customer satisfaction. |
|
Audit and compliance |
Maintain a clear record of which vendor sold each product for financial auditing purposes. |
|
Automated vendor payouts |
Feed vendor‑specific order data into your payment system for automated commission disbursement. |
If your marketplace has more than a handful of vendors, manually tracking vendor attribution in your order exports is simply not scalable. The code in this guide automates the entire process.
Export Dokan seller information
What Does the Code Do?
The provided PHP code adds vendor store information and vendor address fields to every line item in your export. Each time a product is sold, the exporter looks up the vendor who owns that product and pulls their store details.
Here is the complete code as provided in our documentation:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
add_filter( 'woe_fetch_order_product', function($row, $order, $item, $product, $item_meta ) { $user_id = $product->post->post_author; if($user_id) { $data = get_user_meta($user_id,"dokan_profile_settings", true); if( $data ) { foreach($row as $k=>$v) { if(preg_match("#^dokan_(.+)$#",$k,$m)) { $d_key = $m[1]; if(preg_match("#^address_(.+)$#",$d_key,$m) ) $d_val = $data['address'][$m[1]]; else $d_val = $data[$d_key]; $row[$k] = $d_val; } // endif dokan key } }//endif $data } return $row; },10,5); |
Put PHP code in section “Misc Settings”
Available Vendor Fields
Follow to article.
The code recognises any column name that starts with dokan_ in your export profile. You can add any of these fields to your export layout:
| Field Key | Data Returned |
|---|---|
dokan_store_name | Vendor’s store name |
dokan_phone | Vendor’s phone number |
dokan_address_street_1 | Address line 1 |
dokan_address_street_2 | Address line 2 |
dokan_address_city | City |
dokan_address_state | State / Province |
dokan_address_zip | Postal / Zip code |
dokan_address_country | Country (ISO code) |
To add these fields to your export, simply include them as column headers in your Setup Fields configuration.