Do not export a customer data group containing no data

This commit is contained in:
Allen Snook 2018-06-01 14:58:09 -07:00
parent c68b8faa99
commit bfb6bff87c
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(