Automattic\WooCommerce\Internal\CLI\Migrator\Core

MigratorTracker::on_batch_processedpublicWC 1.0

Handle batch processing completion.

Method of the class: MigratorTracker{}

No Hooks.

Returns

null. Nothing (null).

Usage

$MigratorTracker = new MigratorTracker();
$MigratorTracker->on_batch_processed( $batch_results, $source_data, $mapped_data ): void;
$batch_results(array) (required)
Results from the batch import.
$source_data(array) (required)
Source platform data for the batch.
$mapped_data(array) (required)
Mapped WooCommerce data for the batch.

MigratorTracker::on_batch_processed() code WC 10.7.0

public function on_batch_processed( array $batch_results, array $source_data, array $mapped_data ): void {
	if ( empty( $this->current_session ) ) {
		return;
	}

	// Track detailed statistics for better telemetry accuracy.
	$batch_stats                                   = $batch_results['stats'] ?? array();
	$this->current_session['products_attempted']  += count( $mapped_data );
	$this->current_session['products_successful'] += $batch_stats['successful'] ?? 0;
	$this->current_session['products_failed']     += $batch_stats['failed'] ?? 0;
	$this->current_session['products_skipped']    += $batch_stats['skipped'] ?? 0;

	$this->track_product_types( $mapped_data, $batch_results );
}