Automattic\WooCommerce\Internal\StockNotifications

NotificationQuery::get_matching_notification_id │ public static │ WC 1.0

Get the ID of the active or pending notification matching an identity, product and posted attribute set.

Method of the class: NotificationQuery{}

No Hooks.

Returns

int. The notification ID, or 0 when nothing matches.

Usage

$result = NotificationQuery::get_matching_notification_id( $product_id, $user_id, $user_email, $posted_attributes ): int;
$product_id(int) (required)
The product ID.
$user_id(int) (required)
The user ID, or 0 to match on the email instead.
$user_email(string) (required)
The email address, used when no user ID is given.
$posted_attributes(array)
The posted attributes to match.
Default: array()

NotificationQuery::get_matching_notification_id() code WC 11.3.0

public static function get_matching_notification_id( int $product_id, int $user_id, string $user_email, array $posted_attributes = array() ): int {
	$data_store = self::load_data_store();

	// @phpstan-ignore method.notFound (the call is proxied by WC_Data_Store::__call())
	return $data_store ? absint( $data_store->get_matching_notification_id( $product_id, $user_id, $user_email, $posted_attributes ) ) : 0;
}