Automattic\WooCommerce\Admin\API
Orders::get_customer_by_id
Get customer data from customer_id.
Method of the class: Orders{}
No Hooks.
Returns
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() Orders::get customer by id code WC 10.8.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;
}