WC_Abstract_Order::get_billing_and_current_user_aliases()privateWC 1.0

Helper method to get all aliases for current user and provide billing email.

Method of the class: WC_Abstract_Order{}

No Hooks.

Return

Array. Array of all aliases.

Usage

// private - for code of main (parent) class only
$result = $this->get_billing_and_current_user_aliases( $billing_email );
$billing_email(string) (required)
Billing email provided in form.

WC_Abstract_Order::get_billing_and_current_user_aliases() code WC 9.3.3

private function get_billing_and_current_user_aliases( $billing_email ) {
	$emails = array( $billing_email );
	if ( get_current_user_id() ) {
		$emails[] = wp_get_current_user()->user_email;
	}
	$emails              = array_unique(
		array_map( 'strtolower', array_map( 'sanitize_email', $emails ) )
	);
	$customer_data_store = WC_Data_Store::load( 'customer' );
	$user_ids            = $customer_data_store->get_user_ids_for_billing_email( $emails );
	return array_merge( $user_ids, $emails );
}