WordPress at Your Fingertips
function is not described

WC_Product_CSV_Exporter::get_column_value_published() protected WC 3.1.0

Get published value.

{} It's a method of the class: WC_Product_CSV_Exporter{}

No Hooks.

Return

Int.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_column_value_published( $product );
$product(WC_Product) (required)
Product being exported.

Changelog

Since 3.1.0 Introduced.

Code of WC_Product_CSV_Exporter::get_column_value_published() WC 5.9.0

protected function get_column_value_published( $product ) {
	$statuses = array(
		'draft'   => -1,
		'private' => 0,
		'publish' => 1,
	);

	// Fix display for variations when parent product is a draft.
	if ( 'variation' === $product->get_type() ) {
		$parent = $product->get_parent_data();
		$status = 'draft' === $parent['status'] ? $parent['status'] : $product->get_status( 'edit' );
	} else {
		$status = $product->get_status( 'edit' );
	}

	return isset( $statuses[ $status ] ) ? $statuses[ $status ] : -1;
}