Automattic\WooCommerce\Internal\Admin\Schedulers

ImportScheduler::import_batch_init()public staticWC 1.0

Queue the imports into multiple batches.

Method of the class: ImportScheduler{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = ImportScheduler::import_batch_init( $days, $skip_existing );
$days(int|true|false) (required)
Number of days to import.
$skip_existing(true|false) (required)
Skip existing records.

ImportScheduler::import_batch_init() code WC 9.4.2

public static function import_batch_init( $days, $skip_existing ) {
	$batch_size = static::get_batch_size( 'import' );
	$items      = static::get_items( 1, 1, $days, $skip_existing );

	if ( 0 === $items->total ) {
		return;
	}

	$num_batches = ceil( $items->total / $batch_size );

	self::queue_batches( 1, $num_batches, 'import_batch', array( $days, $skip_existing ) );
}