Merge pull request #20347 from woocommerce/fix/20346-empty-customer-data-export

Do not export a customer data group containing no data
This commit is contained in:
Mike Jolley 2018-06-04 10:44:17 +01:00 committed by GitHub
commit f40f52ef14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -25,12 +25,15 @@ class WC_Privacy_Exporters {
$data_to_export = array();
if ( $user instanceof WP_User ) {
$data_to_export[] = array(
'group_id' => 'woocommerce_customer',
'group_label' => __( 'Customer Data', 'woocommerce' ),
'item_id' => 'user',
'data' => self::get_customer_personal_data( $user ),
);
$customer_personal_data = self::get_customer_personal_data( $user );
if ( ! empty( $customer_personal_data ) ) {
$data_to_export[] = array(
'group_id' => 'woocommerce_customer',
'group_label' => __( 'Customer Data', 'woocommerce' ),
'item_id' => 'user',
'data' => $customer_personal_data,
);
}
}
return array(