Set customer email in reports data if available (#51367)
* Set customer email in reports data if available. * Add changelog * Lint
This commit is contained in:
parent
bf0646c307
commit
e4d995938f
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Set customer email in reports if customer data is available
|
|
@ -615,6 +615,11 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
|
|||
if ( is_null( $customer_user ) ) {
|
||||
$customer_user = new \WC_Customer( $user_id );
|
||||
}
|
||||
|
||||
// Set email as customer email instead of Order Billing Email if we have a customer.
|
||||
$data['email'] = $customer_user->get_email( 'edit' );
|
||||
|
||||
// Adding other relevant customer data.
|
||||
$data['user_id'] = $user_id;
|
||||
$data['username'] = $customer_user->get_username( 'edit' );
|
||||
$data['date_registered'] = $customer_user->get_date_created( 'edit' ) ? $customer_user->get_date_created( 'edit' )->date( TimeInterval::$sql_datetime_format ) : null;
|
||||
|
|
Loading…
Reference in New Issue