Automattic\WooCommerce\Internal\Admin\Orders

ListTable::count_orders_by_status()privateWC 1.0

Count orders by status.

Method of the class: ListTable{}

No Hooks.

Return

Int.

Usage

// private - for code of main (parent) class only
$result = $this->count_orders_by_status( $status ): int;
$status(string) (required)
The order status we are interested in.

ListTable::count_orders_by_status() code WC 7.1.1

private function count_orders_by_status( string $status ): int {
	$orders = wc_get_orders(
		array(
			'limit'  => -1,
			'return' => 'ids',
			'status' => $status,
		)
	);

	return count( $orders );
}