Automattic\WooCommerce\Internal\Admin\Orders

ListTable::do_untrash()privateWC 1.0

Handles bulk restoration of trashed orders.

Method of the class: ListTable{}

No Hooks.

Return

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

Usage

// private - for code of main (parent) class only
$result = $this->do_untrash( $ids ): int;
$ids(array) (required)
Order IDs to be restored to their previous status.

ListTable::do_untrash() code WC 8.6.1

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