WC_Product_CSV_Exporter::get_column_value_published
Get published value.
Method of the class: WC_Product_CSV_Exporter{}
No Hooks.
Returns
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 10.4.3
protected function get_column_value_published( $product ) {
$statuses = array(
ProductStatus::DRAFT => -1,
ProductStatus::PRIVATE => 0,
ProductStatus::PUBLISH => 1,
);
// Fix display for variations when parent product is a draft.
if ( ProductType::VARIATION === $product->get_type() ) {
$parent = $product->get_parent_data();
$status = ProductStatus::DRAFT === $parent['status'] ? $parent['status'] : $product->get_status( 'edit' );
} else {
$status = $product->get_status( 'edit' );
}
return isset( $statuses[ $status ] ) ? $statuses[ $status ] : -1;
}