WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WC_Product_CSV_Importer::import() public WC 1.0

Process importer.

Do not import products with IDs or SKUs that already exist if option update existing is false, and likewise, if updating products, do not process rows which do not exist if an ID/SKU is provided.

{} Это метод класса: WC_Product_CSV_Importer{}

Хуки из метода
Возвращает

Массив. Ничего.

Использование

$WC_Product_CSV_Importer = new WC_Product_CSV_Importer();
$WC_Product_CSV_Importer->import();

Код WC_Product_CSV_Importer::import() WC 5.2.2

<?php
public function import() {
	$this->start_time = time();
	$index            = 0;
	$update_existing  = $this->params['update_existing'];
	$data             = array(
		'imported' => array(),
		'failed'   => array(),
		'updated'  => array(),
		'skipped'  => array(),
	);

	foreach ( $this->parsed_data as $parsed_data_key => $parsed_data ) {
		do_action( 'woocommerce_product_import_before_import', $parsed_data );

		$id         = isset( $parsed_data['id'] ) ? absint( $parsed_data['id'] ) : 0;
		$sku        = isset( $parsed_data['sku'] ) ? $parsed_data['sku'] : '';
		$id_exists  = false;
		$sku_exists = false;

		if ( $id ) {
			$product   = wc_get_product( $id );
			$id_exists = $product && 'importing' !== $product->get_status();
		}

		if ( $sku ) {
			$id_from_sku = wc_get_product_id_by_sku( $sku );
			$product     = $id_from_sku ? wc_get_product( $id_from_sku ) : false;
			$sku_exists  = $product && 'importing' !== $product->get_status();
		}

		if ( $id_exists && ! $update_existing ) {
			$data['skipped'][] = new WP_Error(
				'woocommerce_product_importer_error',
				esc_html__( 'A product with this ID already exists.', 'woocommerce' ),
				array(
					'id'  => $id,
					'row' => $this->get_row_id( $parsed_data ),
				)
			);
			continue;
		}

		if ( $sku_exists && ! $update_existing ) {
			$data['skipped'][] = new WP_Error(
				'woocommerce_product_importer_error',
				esc_html__( 'A product with this SKU already exists.', 'woocommerce' ),
				array(
					'sku' => esc_attr( $sku ),
					'row' => $this->get_row_id( $parsed_data ),
				)
			);
			continue;
		}

		if ( $update_existing && ( isset( $parsed_data['id'] ) || isset( $parsed_data['sku'] ) ) && ! $id_exists && ! $sku_exists ) {
			$data['skipped'][] = new WP_Error(
				'woocommerce_product_importer_error',
				esc_html__( 'No matching product exists to update.', 'woocommerce' ),
				array(
					'id'  => $id,
					'sku' => esc_attr( $sku ),
					'row' => $this->get_row_id( $parsed_data ),
				)
			);
			continue;
		}

		$result = $this->process_item( $parsed_data );

		if ( is_wp_error( $result ) ) {
			$result->add_data( array( 'row' => $this->get_row_id( $parsed_data ) ) );
			$data['failed'][] = $result;
		} elseif ( $result['updated'] ) {
			$data['updated'][] = $result['id'];
		} else {
			$data['imported'][] = $result['id'];
		}

		$index ++;

		if ( $this->params['prevent_timeouts'] && ( $this->time_exceeded() || $this->memory_exceeded() ) ) {
			$this->file_position = $this->file_positions[ $index ];
			break;
		}
	}

	return $data;
}