Add main order id column in vendor order page

Add the below code on your functions.php file of your current active theme to add the main order id in the vendor dashboard along with the suborder id –

add_filter('mvx_datatable_order_list_table_headers', 'test_callback', 10, 2);
function test_callback($orders_list_table_headers, $current_user_id) {
    $orders_list_table_headers['main_order_id'] = array('label' => __( 'Main Order', 'multivendorx' ));
    return $orders_list_table_headers;
}
add_filter('mvx_datatable_order_list_row', 'test_function', 10, 2);
function test_function($vendor_rows, $order) {
    $vendor_rows['main_order_id'] = wp_get_post_parent_id( $order->get_id() );
    return $vendor_rows;
}

Leave a Reply