WC_Privacy_Exporters::get_download_personal_data()protected staticWC 3.4.0

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

Method of the class: WC_Privacy_Exporters{}

Return

Array.

Usage

$result = WC_Privacy_Exporters::get_download_personal_data( $download );
$download(WC_Order) (required)
Download object.

Changelog

Since 3.4.0 Introduced.

WC_Privacy_Exporters::get_download_personal_data() code WC 9.3.3

protected static function get_download_personal_data( $download ) {
	$personal_data = array(
		array(
			'name'  => __( 'Download ID', 'woocommerce' ),
			'value' => $download->get_id(),
		),
		array(
			'name'  => __( 'Order ID', 'woocommerce' ),
			'value' => $download->get_order_id(),
		),
		array(
			'name'  => __( 'Product', 'woocommerce' ),
			'value' => get_the_title( $download->get_product_id() ),
		),
		array(
			'name'  => __( 'User email', 'woocommerce' ),
			'value' => $download->get_user_email(),
		),
		array(
			'name'  => __( 'Downloads remaining', 'woocommerce' ),
			'value' => $download->get_downloads_remaining(),
		),
		array(
			'name'  => __( 'Download count', 'woocommerce' ),
			'value' => $download->get_download_count(),
		),
		array(
			'name'  => __( 'Access granted', 'woocommerce' ),
			'value' => gmdate( 'Y-m-d', $download->get_access_granted( 'edit' )->getTimestamp() ),
		),
		array(
			'name'  => __( 'Access expires', 'woocommerce' ),
			'value' => ! is_null( $download->get_access_expires( 'edit' ) ) ? gmdate( 'Y-m-d', $download->get_access_expires( 'edit' )->getTimestamp() ) : null,
		),
	);

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

	return $personal_data;
}