Automattic\WooCommerce\Internal\Admin\Orders

ListTable::count_orders_by_statusprivateWC 1.0

Count orders by status.

Method of the class: ListTable{}

Returns

Int.

Usage

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

ListTable::count_orders_by_status() code WC 10.8.1

private function count_orders_by_status( $status ): int {
	$status = (array) $status;
	$counts = OrderUtil::get_count_for_type( $this->order_type );
	$count  = array_sum( array_intersect_key( $counts, array_flip( $status ) ) );

	/**
	 * Allows 3rd parties to modify the count of orders by status.
	 *
	 * @param int      $count  Number of orders for the given status.
	 * @param string[] $status List of order statuses in the count.
	 * @since 7.3.0
	 */
	return apply_filters(
		'woocommerce_' . $this->order_type . '_list_table_order_count',
		$count,
		$status
	);
}