WC_Privacy::trash_orders_query()protected staticWC 3.4.0

For a given query trash all matches.

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

Хуков нет.

Возвращает

int. Count of orders that were trashed.

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

$result = WC_Privacy::trash_orders_query( $query );
$query(массив) (обязательный)
Query array to pass to wc_get_orders().

Список изменений

С версии 3.4.0 Введена.

Код WC_Privacy::trash_orders_query() WC 8.7.0

protected static function trash_orders_query( $query ) {
	$orders = wc_get_orders( $query );
	$count  = 0;

	if ( $orders ) {
		foreach ( $orders as $order ) {
			$order->delete( false );
			$count ++;
		}
	}

	return $count;
}