WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Product_Importer::process_item() WC 1.0

Process a single item and save.

Это метод класса: WC_Product_Importer

Возвращает

Массив/WC_Error.

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

$WC_Product_Importer = new WC_Product_Importer();
$var = $WC_Product_Importer->process_item( $data );
$data(массив) (обязательный)
Raw CSV data.

Код WC Product Importer::process item: woocommerce/includes/import/abstract-wc-product-importer.php WC 3.6.5

<?php
protected function process_item( $data ) {
	try {
		do_action( 'woocommerce_product_import_before_process_item', $data );

		// Get product ID from SKU if created during the importation.
		if ( empty( $data['id'] ) && ! empty( $data['sku'] ) ) {
			$product_id = wc_get_product_id_by_sku( $data['sku'] );

			if ( $product_id ) {
				$data['id'] = $product_id;
			}
		}

		$object   = $this->get_product_object( $data );
		$updating = false;

		if ( is_wp_error( $object ) ) {
			return $object;
		}

		if ( $object->get_id() && 'importing' !== $object->get_status() ) {
			$updating = true;
		}

		if ( 'external' === $object->get_type() ) {
			unset( $data['manage_stock'], $data['stock_status'], $data['backorders'], $data['low_stock_amount'] );
		}

		if ( 'variation' === $object->get_type() ) {
			if ( isset( $data['status'] ) && -1 === $data['status'] ) {
				$data['status'] = 0; // Variations cannot be drafts - set to private.
			}
		}

		if ( 'importing' === $object->get_status() ) {
			$object->set_status( 'publish' );
			$object->set_slug( '' );
		}

		$result = $object->set_props( array_diff_key( $data, array_flip( array( 'meta_data', 'raw_image_id', 'raw_gallery_image_ids', 'raw_attributes' ) ) ) );

		if ( is_wp_error( $result ) ) {
			throw new Exception( $result->get_error_message() );
		}

		if ( 'variation' === $object->get_type() ) {
			$this->set_variation_data( $object, $data );
		} else {
			$this->set_product_data( $object, $data );
		}

		$this->set_image_data( $object, $data );
		$this->set_meta_data( $object, $data );

		$object = apply_filters( 'woocommerce_product_import_pre_insert_product_object', $object, $data );
		$object->save();

		do_action( 'woocommerce_product_import_inserted_product_object', $object, $data );

		return array(
			'id'      => $object->get_id(),
			'updated' => $updating,
		);
	} catch ( Exception $e ) {
		return new WP_Error( 'woocommerce_product_importer_error', $e->getMessage(), array( 'status' => $e->getCode() ) );
	}
}