WC_Product_CSV_Importer::get_row_id()protectedWC 1.0

Get a string to identify the row from parsed data.

Method of the class: WC_Product_CSV_Importer{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_row_id( $parsed_data );
$parsed_data(array) (required)
Parsed data.

WC_Product_CSV_Importer::get_row_id() code WC 9.7.1

protected function get_row_id( $parsed_data ) {
	$id       = isset( $parsed_data['id'] ) ? absint( $parsed_data['id'] ) : 0;
	$sku      = isset( $parsed_data['sku'] ) ? esc_attr( $parsed_data['sku'] ) : '';
	$name     = isset( $parsed_data['name'] ) ? esc_attr( $parsed_data['name'] ) : '';
	$row_data = array();

	if ( $name ) {
		$row_data[] = $name;
	}
	if ( $id ) {
		/* translators: %d: product ID */
		$row_data[] = sprintf( __( 'ID %d', 'woocommerce' ), $id );
	}
	if ( $sku ) {
		/* translators: %s: product SKU */
		$row_data[] = sprintf( __( 'SKU %s', 'woocommerce' ), $sku );
	}

	return implode( ', ', $row_data );
}