WC_Product_CSV_Importer::parse_published_field( string $value )

Parse the published field. 1 is published, 0 is private, -1 is draft.


Description Description

Alternatively, ‘true’ can be used for published and ‘false’ for draft.


Parameters Parameters

$value

(Required) Field value.


Top ↑

Return Return

(float|string)


Top ↑

Source Source

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

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


Top ↑

User Contributed Notes User Contributed Notes

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