WC_Product_CSV_Importer::parse_float_field │ public │ WC 1.0

Parse a float value field.

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

Хуков нет.

Возвращает

float|string.

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

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

Код WC_Product_CSV_Importer::parse_float_field() WC 11.3.0

public function parse_float_field( $value ) {
	if ( '' === $value ) {
		return $value;
	}

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

	// Use wc_format_decimal() rather than floatval() so the store's decimal separator
	// setting is respected (e.g. a comma-separated weight like "1,5"). This mirrors how
	// price fields are parsed above and how the product setters normalize these values.
	return (float) wc_format_decimal( $value );
}