WC_Customer_Data_Store::get_user_ids_for_billing_emailpublicWC 1.0

Deprecated since 0.3.0. It is no longer supported and may be removed in future releases. Use d by WooCommerce core anymore instead.

Get all user ids who have billing_email set to any of the email passed in array.

Method of the class: WC_Customer_Data_Store{}

No Hooks.

Returns

Array.

Usage

$WC_Customer_Data_Store = new WC_Customer_Data_Store();
$WC_Customer_Data_Store->get_user_ids_for_billing_email( $emails );
$emails(array) (required)
List of emails to check against.

Changelog

Deprecated Since 10.3.0 and not used by WooCommerce core anymore.

WC_Customer_Data_Store::get_user_ids_for_billing_email() code WC 10.3.3

public function get_user_ids_for_billing_email( $emails ) {
	wc_deprecated_function( __METHOD__, '10.3.0' );
	$emails      = array_unique( array_map( 'strtolower', array_map( 'sanitize_email', $emails ) ) );
	$users_query = new WP_User_Query(
		array(
			'fields'     => 'ID',
			'meta_query' => array(
				array(
					'key'     => 'billing_email',
					'value'   => $emails,
					'compare' => 'IN',
				),
			),
		)
	);
	return array_unique( $users_query->get_results() );
}