user3004586 user3004586 - 8 months ago 164
PHP Question

How to remove WooCommerce order status?

I would like to modify a function contained in woocommerce. This is my edited function (


function wc_get_order_statuses() {
$order_statuses = array(
'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ),
/*'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),*/
'wc-on-hold' => _x( 'On Hold', 'Order status', 'woocommerce' ),
'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ),
'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
'wc-refunded' => _x( 'Refunded', 'Order status', 'woocommerce' ),
'wc-failed' => _x( 'Failed', 'Order status', 'woocommerce' ),
return apply_filters( 'wc_order_statuses', $order_statuses );

I tried to load a new function within the
file in the child theme, but does not seem to work.

what I want to achieve is to eliminate the order item "Processing" from the status menu. I also tried with css but those do not support

select option[value="wc-processing"] {display: none !important;}


You need to use filters. Once upon a time, I wrote what I think is a good tutorial explaining WordPress filters

In this case, the end result would be:

function so_39252649_remove_processing_status( $statuses ){
    if( isset( $statuses['wc-processing'] ) ){
        unset( $statuses['wc-processing'] );
    return $statuses;
add_filter( 'wc_order_statuses', 'so_39252649_remove_processing_status' );

Keep in mind, that the processing status is the default status when an order is created, so you may have to make other changes to compensate for it's removal.