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.

Method of the class: WC_Abstract_Order{}

No Hooks.

Returns

Array. Array of all aliases and IDs.

Usage

// private - for code of main (parent) class only
$result = $this->get_billing_and_current_user_ids_and_aliases( $billing_email ): array;
$billing_email(string) (required)
Billing email to look up for.

WC_Abstract_Order::get_billing_and_current_user_ids_and_aliases() code WC 10.3.6

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