WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Privacy_Erasers::order_data_eraser() public WC 3.4.0

Finds and erases data which could be used to identify a person from WooCommerce data assocated with an email address.

Orders are erased in blocks of 10 to avoid timeouts.

Это метод класса: WC_Privacy_Erasers{}

Возвращает

Массив. An array of personal data in name value pairs

Использование

$result = WC_Privacy_Erasers::order_data_eraser( $email_address, $page );
$email_address(строка) (обязательный)
The user email address.
$page(число) (обязательный)
Page.

Список изменений

С версии 3.4.0 Введена.

Код WC_Privacy_Erasers::order_data_eraser() WC 4.5.2

woocommerce/includes/class-wc-privacy-erasers.php
<?php
public static function order_data_eraser( $email_address, $page ) {
	$page            = (int) $page;
	$user            = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
	$erasure_enabled = wc_string_to_bool( get_option( 'woocommerce_erasure_request_removes_order_data', 'no' ) );
	$response        = array(
		'items_removed'  => false,
		'items_retained' => false,
		'messages'       => array(),
		'done'           => true,
	);

	$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 ) {
			if ( apply_filters( 'woocommerce_privacy_erase_order_personal_data', $erasure_enabled, $order ) ) {
				self::remove_order_personal_data( $order );

				/* Translators: %s Order number. */
				$response['messages'][]    = sprintf( __( 'Removed personal data from order %s.', 'woocommerce' ), $order->get_order_number() );
				$response['items_removed'] = true;
			} else {
				/* Translators: %s Order number. */
				$response['messages'][]     = sprintf( __( 'Personal data within order %s has been retained.', 'woocommerce' ), $order->get_order_number() );
				$response['items_retained'] = true;
			}
		}
		$response['done'] = 10 > count( $orders );
	} else {
		$response['done'] = true;
	}

	return $response;
}