| Server IP : 62.72.47.131 / Your IP : 216.73.217.34 Web Server : Apache/2.4.66 (Debian) System : Linux 975cdb959a49 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : ( 501) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/woocommerce/src/Internal/StockNotifications/ |
Upload File : |
<?php
declare( strict_types=1 );
namespace Automattic\WooCommerce\Internal\StockNotifications;
/**
* Notification query class.
*/
class NotificationQuery {
/**
* Get notifications.
*
* @param array $args The arguments to pass to the query.
* @return array The notifications.
*/
public static function get_notifications( array $args ): array {
return \WC_Data_Store::load( 'stock_notification' )->query( $args );
}
/**
* Check if a product has active notifications.
*
* @param array<int> $product_ids The product IDs to check.
* @return bool True if the product has active notifications, false otherwise.
*/
public static function product_has_active_notifications( array $product_ids ): bool {
return \WC_Data_Store::load( 'stock_notification' )->product_has_active_notifications( $product_ids );
}
/**
* Check if a notification exists by email.
*
* @param int $product_id The product ID.
* @param string $email The email address.
* @return bool True if the notification exists, false otherwise.
*/
public static function notification_exists_by_email( int $product_id, string $email ): bool {
return \WC_Data_Store::load( 'stock_notification' )->notification_exists_by_email( $product_id, $email );
}
/**
* Get a notification by user ID.
*
* @param int $product_id The product ID.
* @param int $user_id The user ID.
* @return bool True if the notification exists, false otherwise.
*/
public static function notification_exists_by_user_id( int $product_id, int $user_id ): bool {
return \WC_Data_Store::load( 'stock_notification' )->notification_exists_by_user_id( $product_id, $user_id );
}
}