WC_Product_CSV_Importer::parse_int_fieldpublicWC 1.0

Parse an int value field

Method of the class: WC_Product_CSV_Importer{}

No Hooks.

Returns

Int|String.

Usage

$WC_Product_CSV_Importer = new WC_Product_CSV_Importer();
$WC_Product_CSV_Importer->parse_int_field( $value );
$value(int) (required)
field value.

WC_Product_CSV_Importer::parse_int_field() code WC 10.3.6

public function parse_int_field( $value ) {
	// Similar to WC_Meta_Box_Product_Data::save, do not cast the empty value to int.
	// An empty value indicates that the field should be cleared.
	if ( '' === $value ) {
		return $value;
	}

	// Remove the ' prepended to fields that start with - if needed.
	$value = $this->unescape_data( $value );

	return intval( $value );
}