Automattic\WooCommerce\Blocks\Domain\Services
DraftOrders::delete_draft_order_post_status_from_args
Remove draft status from the 'status' argument of an $args array.
Method of the class: DraftOrders{}
No Hooks.
Returns
Array.
Usage
$DraftOrders = new DraftOrders(); $DraftOrders->delete_draft_order_post_status_from_args( $args );
- $args(array) (required)
- Array of arguments containing statuses in the status key.
DraftOrders::delete_draft_order_post_status_from_args() DraftOrders::delete draft order post status from args code WC 10.8.1
public function delete_draft_order_post_status_from_args( $args ) {
if ( ! array_key_exists( 'status', $args ) ) {
$statuses = [];
foreach ( wc_get_order_statuses() as $key => $label ) {
if ( self::DB_STATUS !== $key ) {
$statuses[] = str_replace( 'wc-', '', $key );
}
}
$args['status'] = $statuses;
} elseif ( self::DB_STATUS === $args['status'] ) {
$args['status'] = '';
} elseif ( is_array( $args['status'] ) ) {
$args['status'] = array_diff_key( $args['status'], array( self::STATUS => null ) );
}
return $args;
}