wc_migrator_session_started action-hookWC 10.3.0

Fires when a migration session starts.

Usage

add_action( 'wc_migrator_session_started', 'wp_kama_wc_migrator_session_started_action', 10, 2 );

/**
 * Function for `wc_migrator_session_started` action-hook.
 * 
 * @param string $platform The platform being migrated from.
 * @param array  $metadata Session metadata including session_id, filters, and fields.
 *
 * @return void
 */
function wp_kama_wc_migrator_session_started_action( $platform, $metadata ){

	// action...
}
$platform(string)
The platform being migrated from.
$metadata(array)
Session metadata including session_id, filters, and fields.

Changelog

Since 10.3.0 Introduced.

Where the hook is called

ProductsController::migrate_products()
wc_migrator_session_started
woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php 147-157
do_action(
	'wc_migrator_session_started',
	$this->parsed_args['platform'],
	array(
		'session_id' => $this->session->get_id(),
		'filters'    => $this->parsed_args['filters'],
		'fields'     => $this->fields_to_process,
		'is_dry_run' => $this->parsed_args['dry_run'],
		'resume'     => $this->parsed_args['resume'],
	)
);

Where the hook is used in WooCommerce

woocommerce/src/Internal/CLI/Migrator/Core/MigratorTracker.php 47
add_action( 'wc_migrator_session_started', array( $this, 'on_session_started' ), 10, 2 );