Skip to content

Instantly share code, notes, and snippets.

@WillBrubaker
Created May 14, 2015 15:27
Show Gist options
  • Save WillBrubaker/c94e2e55a83dc9e8658d to your computer and use it in GitHub Desktop.
Save WillBrubaker/c94e2e55a83dc9e8658d to your computer and use it in GitHub Desktop.
Adds user roles to the customer export when using WooCommerce Customer/Order CSV Export
add_filter( 'wc_customer_order_csv_export_customer_headers', 'wooninja_customer_headers' );
function wooninja_customer_headers( $column_headers ) {
$column_headers['user_role'] = 'user_role';
return $column_headers;
}
add_filter( 'wc_customer_order_csv_export_customer_row', 'wooninja_customer_role', 10, 2 );
function wooninja_customer_role( $customer_data, $user ) {
$customer_data['user_role'] = implode( ' ', $user->roles );
return $customer_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment