WooCommerce Product Vendors
Running a multi-vendor marketplace? Need to know which vendor sells which product?
WooCommerce Product Vendors assigns each product to a vendor. Standard exports don’t show this.
Here’s how to export vendor name and email for every product row.
What this code exports
Adds two columns to your product export:
- Vendor Name (e.g., “ABC Supplies”)
- Vendor Email (e.g., “[email protected]”)
Each product shows its assigned vendor.
The complete code
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
// add product fields "Vendor Email" and "Vendor Name" add_filter('woe_get_order_product_fields', function ($fields,$format) { $fields['vendor_email'] = array( 'label' => 'Vendor email', 'colname' => 'Vendor email', 'checked' => 1 ); $fields['vendor_name'] = array( 'label' => 'Vendor email', 'colname' => 'Vendor email', 'checked' => 1 ); return $fields; }, 10, 2); add_filter('woe_get_order_product_value_vendor_email', function ($value,$order, $item, $product,$itemmeta) { $vendor = WC_Product_Vendors_Utils::is_vendor_product( $item['product_id'] ); if ( $vendor AND !empty( $vendor[0] ) ) { $vendor_data = WC_Product_Vendors_Utils::get_vendor_data_by_id($vendor[0]->term_id); if ( ! empty( $vendor_data ) ) $value = $vendor_data['email']; } return $value; }, 10, 5); add_filter('woe_get_order_product_value_vendor_name', function ($value,$order, $item, $product,$itemmeta) { $vendor = WC_Product_Vendors_Utils::is_vendor_product( $item['product_id'] ); if ( $vendor AND !empty( $vendor[0] ) ) { $vendor_data = WC_Product_Vendors_Utils::get_vendor_data_by_id($vendor[0]->term_id); if ( ! empty( $vendor_data ) ) $value = $vendor_data['name']; } return $value; }, 10, 5); |
Setup steps
- Copy the entire code block
- Paste into your theme’s
functions.php - Go to Advanced Order Export for WooCommerce
- Create or edit an export profile
- Open Setup Fields → Products
- You’ll see “Vendor email” and “Vendor name” fields
- Check the ones you need
- Save and test on an order with vendor products
What your export looks like
| Order | Product | Quantity | Vendor Name | Vendor Email |
|---|---|---|---|---|
| #1001 | Blue Widget | 2 | ABC Supplies | [email protected] |
| #1001 | Red Gadget | 1 | XYZ Tech | [email protected] |
| #1002 | Green Tool | 3 | ABC Supplies | [email protected] |
Each product row shows its vendor. Easy to filter or sort by vendor.
When you need this
You run a marketplace. Need to split order reports by vendor.
Your accounting team needs vendor-specific sales data.
You pay commissions per vendor. Need vendor email for payment notifications.
You fulfill orders by vendor. Need to know which vendor supplies which product.
How it works
WooCommerce Product Vendors stores vendor information as taxonomy terms. Each product gets assigned to a vendor term.
The code checks if a product has a vendor. Finds the vendor data. Pulls the name and email.
Common mistake
The code expects the official WooCommerce Product Vendors plugin (from WooCommerce.com). Not third-party marketplace plugins.
Also, products must have vendors assigned. Unassigned products return empty columns.
Empty columns?
Three possibilities:
- Product has no vendor assigned
- Vendor exists but has no email or name saved
- Wrong plugin version (code uses
WC_Product_Vendors_Utilsclass)
Check your product edit screen. Verify a vendor is selected.
Pro tip
Need more vendor fields? Add vendor ID, commission rate, or phone number.
Extend the $fields array:
|
1 2 |
$fields['vendor_id'] = array('label' => 'Vendor ID', 'colname' => 'Vendor ID', 'checked' => 1); $fields['vendor_commission'] = array('label' => 'Commission Rate', 'colname' => 'Commission Rate', 'checked' => 1); |
Then add similar filters for each new field. Pull from $vendor_data.
Real talk
Product Vendors stores vendor assignments at product level. Not at order level. That’s why standard order exports miss it.
This code checks each product individually. Pulls the vendor information. Adds it to your export.
Perfect for marketplace owners. Your vendor reports become automatic. No more manual spreadsheet merges.