WC_Product_CSV_Exporter::get_column_value_published()
Get published value.
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. |
WC_Product_CSV_Exporter::get_column_value_published() WC Product CSV Exporter::get column value published code WC 9.4.2
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; }