WC_Abstract_Order::get_billing_and_current_user_ids_and_aliasesprivateWC 1.0

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

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->get_billing_and_current_user_ids_and_aliases( $billing_email ): array;
$billing_email(строка) (обязательный)
Billing email to look up for.

Код WC_Abstract_Order::get_billing_and_current_user_ids_and_aliases() WC 11.0.1

private function get_billing_and_current_user_ids_and_aliases( $billing_email ): array {
	$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 ) ) );
	$user_ids = wc_get_container()->get( CustomersSearchService::class )->find_user_ids_by_billing_email_for_coupons_usage_lookup( $emails );
	return array_merge( $user_ids, $emails );
}