Multivendor - How to remove the vendor orders in CSV exported with WooCommerce Customer / Order CSV Export

To remove the vendors' orders in CSV exported WooCommerce Customer / Order Export CSV enter the following code in the functions.php of your theme:

 

if( function_exists( 'YITH_Vendors' ) && function_exists( 'wc_customer_order_csv_export' ) ){
function yith_wc_customer_order_csv_export_ids( $ids ){
$temp_ids_array = $ids;
foreach( $temp_ids_array as $key => $id ){
$order = wc_get_order( $id );
if( $order instanceof WC_Order && $order->post->post_parent != 0 ){
unset( $ids[ $key ] );
}
}
return $ids;
}

add_filter( 'wc_customer_order_csv_export_ids', 'yith_wc_customer_order_csv_export_ids' );
}

Was this article helpful?
0 out of 0 found this helpful

Back to Help Center

Powered by Zendesk