Automattic\WooCommerce\Internal\StockNotifications\Utilities
EligibilityService::has_active_notifications
Check if a product (or its relevant variations) has any active notifications.
Method of the class: EligibilityService{}
No Hooks.
Returns
true|false. True if the product has active notifications, false otherwise.
Usage
$EligibilityService = new EligibilityService(); $EligibilityService->has_active_notifications( $product ): bool;
- $product(WC_Product) (required)
- The product to check.
EligibilityService::has_active_notifications() EligibilityService::has active notifications code WC 10.3.6
public function has_active_notifications( WC_Product $product ): bool {
$lookup_ids = $this->get_target_product_ids( $product );
if ( empty( $lookup_ids ) ) {
return false;
}
return NotificationQuery::product_has_active_notifications( $lookup_ids );
}