Automattic\WooCommerce\Internal\Admin\Orders

ListTable::do_untrash()privateWC 1.0

Handles bulk restoration of trashed orders.

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

Хуков нет.

Возвращает

int. Number of orders that were restored from the trash.

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

// private - только в коде основоного (родительского) класса
$result = $this->do_untrash( $ids ): int;
$ids(массив) (обязательный)
Order IDs to be restored to their previous status.

Код ListTable::do_untrash() WC 8.7.0

private function do_untrash( array $ids ): int {
	$orders_store = wc_get_container()->get( OrdersTableDataStore::class );
	$changed      = 0;

	foreach ( $ids as $id ) {
		if ( $orders_store->untrash_order( wc_get_order( $id ) ) ) {
			$changed++;
		}
	}

	return $changed;
}