Automattic\WooCommerce\Admin\API

Orders::get_customer_by_id()protectedWC 1.0

Get customer data from customer_id.

Method of the class: Orders{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_customer_by_id( $customer_id );
$customer_id(array) (required)
ID of customer.

Orders::get_customer_by_id() code WC 8.6.1

protected function get_customer_by_id( $customer_id ) {
	global $wpdb;

	$customer_lookup_table = $wpdb->prefix . 'wc_customer_lookup';

	$customer = $wpdb->get_row(
		$wpdb->prepare(
			// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
			"SELECT * FROM {$customer_lookup_table} WHERE customer_id = ( %d )",
			$customer_id
		),
		ARRAY_A
	);

	return $customer;
}