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.

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

Хуков нет.

Возвращает

Массив. Array of all aliases.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_billing_and_current_user_aliases( $billing_email );
$billing_email(строка) (обязательный)
Billing email provided in form.

Код WC_Abstract_Order::get_billing_and_current_user_aliases() WC 8.7.0

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 );
}