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

WC_Product_CSV_Importer::parse_id_field() public WC 1.0

Parse the ID field.

If we're not doing an update, create a placeholder product so mapping works for rows following this one.

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

Хуков нет.

Возвращает

Число. Ничего.

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

$WC_Product_CSV_Importer = new WC_Product_CSV_Importer();
$WC_Product_CSV_Importer->parse_id_field( $value );
$value(строка) (обязательный)
Field value.

Код WC_Product_CSV_Importer::parse_id_field() WC 5.2.2

<?php
public function parse_id_field( $value ) {
	global $wpdb;

	$id = absint( $value );

	if ( ! $id ) {
		return 0;
	}

	// See if this maps to an ID placeholder already.
	$original_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_original_id' AND meta_value = %s;", $id ) ); // WPCS: db call ok, cache ok.

	if ( $original_id ) {
		return absint( $original_id );
	}

	// Not updating? Make sure we have a new placeholder for this ID.
	if ( ! $this->params['update_existing'] ) {
		$mapped_keys      = $this->get_mapped_keys();
		$sku_column_index = absint( array_search( 'sku', $mapped_keys, true ) );
		$row_sku          = isset( $this->raw_data[ $this->parsing_raw_data_index ][ $sku_column_index ] ) ? $this->raw_data[ $this->parsing_raw_data_index ][ $sku_column_index ] : '';
		$id_from_sku      = $row_sku ? wc_get_product_id_by_sku( $row_sku ) : '';

		// If row has a SKU, make sure placeholder was not made already.
		if ( $id_from_sku ) {
			return $id_from_sku;
		}

		$product = wc_get_product_object( 'simple' );
		$product->set_name( 'Import placeholder for ' . $id );
		$product->set_status( 'importing' );
		$product->add_meta_data( '_original_id', $id, true );

		// If row has a SKU, make sure placeholder has it too.
		if ( $row_sku ) {
			$product->set_sku( $row_sku );
		}
		$id = $product->save();
	}

	return $id && ! is_wp_error( $id ) ? $id : 0;
}