WC_Privacy::anonymize_refunded_orderspublic staticWC 9.8.0

Find and Anonymize refunded orders.

Метод класса: WC_Privacy{}

Возвращает

int. Number of orders processed.

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

$result = WC_Privacy::anonymize_refunded_orders( $limit );
$limit(int)
Limit orders to process per batch.
По умолчанию: 20

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

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

Код WC_Privacy::anonymize_refunded_orders() WC 9.9.4

public static function anonymize_refunded_orders( $limit = 20 ) {
	$option = wc_parse_relative_date_option( get_option( 'woocommerce_anonymize_refunded_orders' ) );

	if ( empty( $option['number'] ) ) {
		return 0;
	}

	return self::anonymize_orders_query(
		/**
		 * Filter to modify the query arguments for anonymizing refunded orders.
		 *
		 * @since 9.8.0
		 *
		 * @param string $date_created The date before which orders should be anonymized.
		 * @param int    $limit The maximum number of orders to process in each batch.
		 * @param string $status The status of the orders to be anonymized.
		 * @param string $type The type of orders to be anonymized.
		 */
		apply_filters(
			'woocommerce_anonymize_refunded_orders_query_args',
			array(
				'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
				'limit'        => $limit, // Batches of 20.
				'status'       => OrderInternalStatus::REFUNDED,
				'type'         => 'shop_order',
			)
		)
	);
}