WordPress at Your Fingertips
function is not described


DataStore::get_guest_id_by_email() public WC 1.0

Retrieve a guest ID (when user_id is null) by email.

{} It's a method of the class: DataStore{}

No Hooks.


false|Array. Customer array if found, boolean false if not.


$result = DataStore::get_guest_id_by_email( $email );
$email(string) (required)
Email address.

Code of DataStore::get_guest_id_by_email() WC 6.1.0

public static function get_guest_id_by_email( $email ) {
	global $wpdb;

	$table_name  = self::get_db_table_name();
	$customer_id = $wpdb->get_var(
			// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
			"SELECT customer_id FROM {$table_name} WHERE email = %s AND user_id IS NULL LIMIT 1",

	return $customer_id ? (int) $customer_id : false;