WordPress at a glance
function is not described

WC_Privacy_Exporters::get_customer_personal_data() protected WC 3.4.0

Get personal data (key/value pairs) for a user object.

{} It's a method of the class: WC_Privacy_Exporters{}

Return

Array. Nothing.

Usage

$result = WC_Privacy_Exporters::get_customer_personal_data( $user );
$user(WP_User) (required)
user object.

Changelog

Since 3.4.0 Introduced.

Code of WC_Privacy_Exporters::get_customer_personal_data() WC 5.3.0

<?php
protected static function get_customer_personal_data( $user ) {
	$personal_data = array();
	$customer      = new WC_Customer( $user->ID );

	if ( ! $customer ) {
		return array();
	}

	$props_to_export = apply_filters(
		'woocommerce_privacy_export_customer_personal_data_props',
		array(
			'billing_first_name'  => __( 'Billing First Name', 'woocommerce' ),
			'billing_last_name'   => __( 'Billing Last Name', 'woocommerce' ),
			'billing_company'     => __( 'Billing Company', 'woocommerce' ),
			'billing_address_1'   => __( 'Billing Address 1', 'woocommerce' ),
			'billing_address_2'   => __( 'Billing Address 2', 'woocommerce' ),
			'billing_city'        => __( 'Billing City', 'woocommerce' ),
			'billing_postcode'    => __( 'Billing Postal/Zip Code', 'woocommerce' ),
			'billing_state'       => __( 'Billing State', 'woocommerce' ),
			'billing_country'     => __( 'Billing Country / Region', 'woocommerce' ),
			'billing_phone'       => __( 'Phone Number', 'woocommerce' ),
			'billing_email'       => __( 'Email Address', 'woocommerce' ),
			'shipping_first_name' => __( 'Shipping First Name', 'woocommerce' ),
			'shipping_last_name'  => __( 'Shipping Last Name', 'woocommerce' ),
			'shipping_company'    => __( 'Shipping Company', 'woocommerce' ),
			'shipping_address_1'  => __( 'Shipping Address 1', 'woocommerce' ),
			'shipping_address_2'  => __( 'Shipping Address 2', 'woocommerce' ),
			'shipping_city'       => __( 'Shipping City', 'woocommerce' ),
			'shipping_postcode'   => __( 'Shipping Postal/Zip Code', 'woocommerce' ),
			'shipping_state'      => __( 'Shipping State', 'woocommerce' ),
			'shipping_country'    => __( 'Shipping Country / Region', 'woocommerce' ),
		),
		$customer
	);

	foreach ( $props_to_export as $prop => $description ) {
		$value = '';

		if ( is_callable( array( $customer, 'get_' . $prop ) ) ) {
			$value = $customer->{"get_$prop"}( 'edit' );
		}

		$value = apply_filters( 'woocommerce_privacy_export_customer_personal_data_prop_value', $value, $prop, $customer );

		if ( $value ) {
			$personal_data[] = array(
				'name'  => $description,
				'value' => $value,
			);
		}
	}

	/**
	 * Allow extensions to register their own personal data for this customer for the export.
	 *
	 * @since 3.4.0
	 * @param array    $personal_data Array of name value pairs.
	 * @param WC_Order $order A customer object.
	 */
	$personal_data = apply_filters( 'woocommerce_privacy_export_customer_personal_data', $personal_data, $customer );

	return $personal_data;
}