WC_Product_CSV_Importer::parse_published_field
Parse the published field. 1 is published, 0 is private, -1 is draft. Alternatively, 'true' can be used for published and 'false' for draft.
Method of the class: WC_Product_CSV_Importer{}
No Hooks.
Returns
float|String.
Usage
$WC_Product_CSV_Importer = new WC_Product_CSV_Importer(); $WC_Product_CSV_Importer->parse_published_field( $value );
- $value(string) (required)
- Field value.
WC_Product_CSV_Importer::parse_published_field() WC Product CSV Importer::parse published field code WC 10.8.1
public function parse_published_field( $value ) {
if ( '' === $value ) {
return $value;
}
// Remove the ' prepended to fields that start with - if needed.
$value = $this->unescape_data( $value );
if ( 'true' === strtolower( $value ) || 'false' === strtolower( $value ) ) {
return wc_string_to_bool( $value ) ? 1 : -1;
}
return floatval( $value );
}