From bfb6bff87cf2bac530521eddbc5332d6144e1b31 Mon Sep 17 00:00:00 2001 From: Allen Snook Date: Fri, 1 Jun 2018 14:58:09 -0700 Subject: [PATCH] Do not export a customer data group containing no data --- includes/class-wc-privacy-exporters.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/class-wc-privacy-exporters.php b/includes/class-wc-privacy-exporters.php index d7d6a5cb32e..608c7512539 100644 --- a/includes/class-wc-privacy-exporters.php +++ b/includes/class-wc-privacy-exporters.php @@ -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(