WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\Schedulers

CustomersScheduler::anonymize() public WC 1.0

Anonymize the customer data for a single order.

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

No Hooks.

Return

null. Nothing.

Usage

$result = CustomersScheduler::anonymize( $order_id );
$order_id(int) (required)
Order id.

Code of CustomersScheduler::anonymize() WC 5.3.0

<?php
public static function anonymize( $order_id ) {
	global $wpdb;

	$customer_id = $wpdb->get_var(
		$wpdb->prepare( "SELECT customer_id FROM {$wpdb->prefix}wc_order_stats WHERE order_id = %d", $order_id )
	);

	if ( ! $customer_id ) {
		return;
	}

	// Long form query because $wpdb->update rejects [deleted].
	$deleted_text = __( '[deleted]', 'woocommerce' );
	$updated      = $wpdb->query(
		$wpdb->prepare(
			"UPDATE {$wpdb->prefix}wc_customer_lookup
				SET
					user_id = NULL,
					username = %s,
					first_name = %s,
					last_name = %s,
					email = %s,
					country = '',
					postcode = %s,
					city = %s,
					state = %s
				WHERE
					customer_id = %d",
			array(
				$deleted_text,
				$deleted_text,
				$deleted_text,
				'deleted@site.invalid',
				$deleted_text,
				$deleted_text,
				$deleted_text,
				$customer_id,
			)
		)
	);
	// If the customer row was anonymized, flush the cache.
	if ( $updated ) {
		ReportsCache::invalidate();
	}
}