Automattic\WooCommerce\Internal\Admin\Orders

ListTable::count_orders_by_statusprivateWC 1.0

Count orders by status.

Метод класса: ListTable{}

Возвращает

int.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->count_orders_by_status( $status ): int;
$status(строка|string[]) (обязательный)
The order status we are interested in.

Код ListTable::count_orders_by_status() WC 10.3.4

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
	);
}