WC_Product_CSV_Importer::parse_bool_field( string $value )

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


Description Description


Parameters Parameters

$value

(Required) Field value.


Top ↑

Return Return

(bool|string)


Top ↑

Source Source

File: includes/import/class-wc-product-csv-importer.php

	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 );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.