Automattic\WooCommerce\Internal\CLI\Migrator\Core
ProductsController::configure_product_importer
Configure the injected product importer with options based on parsed arguments.
Method of the class: ProductsController{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->configure_product_importer(): void;
ProductsController::configure_product_importer() ProductsController::configure product importer code WC 10.7.0
private function configure_product_importer(): void {
$import_options = array(
'skip_existing' => $this->parsed_args['skip_existing'] ?? false,
'update_existing' => ! ( $this->parsed_args['skip_existing'] ?? false ),
'import_images' => in_array( 'images', $this->fields_to_process, true ),
'skip_duplicate_images' => true,
'create_categories' => in_array( 'categories', $this->fields_to_process, true ),
'create_tags' => in_array( 'tags', $this->fields_to_process, true ),
'handle_variations' => in_array( 'attributes', $this->fields_to_process, true ),
'assign_default_category' => $this->parsed_args['assign_default_category'] ?? false,
'verbose' => $this->parsed_args['verbose'] ?? false,
);
$this->product_importer->configure( $import_options );
if ( $this->parsed_args['verbose'] ?? false ) {
$this->product_importer->set_progress_callback( array( $this, 'display_product_progress' ) );
}
}