Exporting Products with Seller Names on WooCommerce WCFM
Managing an online store efficiently often involves exporting products with crucial details like the seller’s name. This tutorial will guide you through the process of exporting products with seller names using WooCommerce and the third-party plugin for multivendor marketplaces, WCFM Marketplace. This method enhances transparency and organization in your online marketplace.
Adding a New Column for Export
To begin, add the following code snippet to your child theme’s functions.php
file. This snippet adds a new column labeled “Store” that you can utilize during product imports.
function add_export_column( $columns ) {
$columns['store_id'] = 'Store';
return $columns;
}
add_filter( 'woocommerce_product_export_column_names', 'add_export_column' );
add_filter( 'woocommerce_product_export_product_default_columns', 'add_export_column' );
function add_export_data_store_id( $value, $product ) {
$store_id = wcfm_get_vendor_id_by_post( $product->get_id() );
if($store_id) {
$value = wcfm_get_vendor_store_name($store_id);
}
return $value;
}
add_filter( 'woocommerce_product_export_product_column_store_id', 'add_export_data_store_id', 10, 2 );
Adding Screenshots for Easy Reference
Navigate to Products: Go to your WooCommerce dashboard and click on “Products” in the sidebar menu.
Export Products: Select “Export” from the Products submenu.
Enable Custom Meta Export: Ensure that the “Export custom meta?” checkbox is
Conclusion
By following these steps and incorporating the provided code snippet, you can export products with seller names efficiently using WooCommerce and WCFM Marketplace. The added “Store” column enhances the clarity of your exports, contributing to a well-organized and transparent online marketplace.