Automattic\WooCommerce\Database\Migrations\CustomOrderTable

PostsToOrdersMigrationController::migrate_orders()publicWC 1.0

Migrates a set of orders from the posts table to the custom orders tables.

{} It's a method of the class: PostsToOrdersMigrationController{}

No Hooks.

Return

null. Nothing.

Usage

$PostsToOrdersMigrationController = new PostsToOrdersMigrationController();
$PostsToOrdersMigrationController->migrate_orders( $order_post_ids ): void;
$order_post_ids(array) (required)
List of post IDs of the orders to migrate.

Code of PostsToOrdersMigrationController::migrate_orders() WC 7.1.0

public function migrate_orders( array $order_post_ids ): void {
	$this->error_logger = WC()->call_function( 'wc_get_logger' );

	$using_transactions = $this->maybe_start_transaction();
	if ( null === $using_transactions ) {
		return;
	}

	$errors_were_logged = false;

	foreach ( $this->all_migrators as $migrator ) {
		$errors_were_logged = $this->do_orders_migration_step( $migrator, $order_post_ids );
		if ( $errors_were_logged && $using_transactions ) {
			$this->rollback_transaction();
			break;
		}
	}

	if ( ! $errors_were_logged && $using_transactions ) {
		$this->commit_transaction();
	}
}