WC_Product_CSV_Importer::parse_bool_field()publicWC 1.0

Parse a field that is generally '1' or '0' but can be something else.

Method of the class: WC_Product_CSV_Importer{}

No Hooks.

Return

true|false|String.

Usage

$WC_Product_CSV_Importer = new WC_Product_CSV_Importer();
$WC_Product_CSV_Importer->parse_bool_field( $value );
$value(string) (required)
Field value.

WC_Product_CSV_Importer::parse_bool_field() code WC 8.7.0

public function parse_bool_field( $value ) {
	if ( '0' === $value ) {
		return false;
	}

	if ( '1' === $value ) {
		return true;
	}

	// Don't return explicit true or false for empty fields or values like 'notify'.
	return wc_clean( $value );
}