WC_Privacy_Exporters::order_data_exporter
Finds and exports data which could be used to identify a person from WooCommerce data associated with an email address.
Orders are exported in blocks of 10 to avoid timeouts.
Метод класса: WC_Privacy_Exporters{}
Хуков нет.
Возвращает
Массив. An array of personal data in name value pairs
Использование
$result = WC_Privacy_Exporters::order_data_exporter( $email_address, $page );
- $email_address(строка) (обязательный)
- The user email address.
- $page(int) (обязательный)
- Page.
Список изменений
| С версии 3.4.0 | Введена. |
Код WC_Privacy_Exporters::order_data_exporter() WC Privacy Exporters::order data exporter WC 10.4.3
public static function order_data_exporter( $email_address, $page ) {
$done = true;
$page = (int) $page;
$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
$data_to_export = array();
$order_query = array(
'limit' => 10,
'page' => $page,
'customer' => array( $email_address ),
);
if ( $user instanceof WP_User ) {
$order_query['customer'][] = (int) $user->ID;
}
$orders = wc_get_orders( $order_query );
if ( 0 < count( $orders ) ) {
foreach ( $orders as $order ) {
$data_to_export[] = array(
'group_id' => 'woocommerce_orders',
'group_label' => __( 'Orders', 'woocommerce' ),
'group_description' => __( 'User’s WooCommerce orders data.', 'woocommerce' ),
'item_id' => 'order-' . $order->get_id(),
'data' => self::get_order_personal_data( $order ),
);
}
$done = 10 > count( $orders );
}
return array(
'data' => $data_to_export,
'done' => $done,
);
}