WC_Product_CSV_Importer::parse_bool_field
Parse a field that is generally '1' or '0' but can be something else.
Method of the class: WC_Product_CSV_Importer{}
No Hooks.
Returns
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() WC Product CSV Importer::parse bool field code WC 10.6.2
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 );
}