Hi @muhammadnan
To add the email column to the orders report on the WooCommerce analytics page, you can use the following code snippet:
add_filter( 'woocommerce_admin_report_column_names', 'add_email_column_to_analytics_orders', 10, 1 );
function add_email_column_to_analytics_orders( $columns ) {
$new_columns = array();
foreach ( $columns as $column_name => $column_info ) {
$new_columns[ $column_name ] = $column_info;
if ( 'order_total' === $column_name ) {
$new_columns['order_email'] = __( 'Email', 'woocommerce' );
}
}
return $new_columns;
}
add_action( 'woocommerce_admin_report_column_order_data', 'add_email_data_to_analytics_orders', 10, 3 );
function add_email_data_to_analytics_orders( $column, $order ) {
if ( 'order_email' === $column ) {
echo esc_html( $order->get_billing_email() );
}
}
This code will add a new column to the orders report on the WooCommerce analytics page called “Email” and display the email address of the user who placed the order in that column.
I hope this helps! Let me know if you have any questions.