Automattic\WooCommerce\Internal\StockNotifications
Telemetry::get_notification_counts
The number of notifications in total and per status.
Method of the class: Telemetry{}
No Hooks.
Returns
array<string, int>.
Usage
$result = Telemetry::get_notification_counts(): array;
Telemetry::get_notification_counts() Telemetry::get notification counts code WC 11.2.1
private static function get_notification_counts(): array {
$counts_by_status = wc_get_container()->get( StockNotificationsDataStore::class )->count_by_status();
$counts = array( 'total' => array_sum( $counts_by_status ) );
foreach ( NotificationStatus::get_valid_statuses() as $status ) {
$counts[ $status ] = $counts_by_status[ $status ] ?? 0;
}
return $counts;
}