Terry Tsang

Terry Tsang
About
WooCommerce Custom Order Status Processing

WooCommerce Custom Order Status “Processing”

Sometimes there is a need for a custom new order status for WooCommerce orders such as “Processing”, “Shipment Suspended On Holidays”, “Picked Up by Courier” and so on.

Below is the code snippet you may add to the bottom of theme functions.php for example “Processing” new order status. You may replace text “Processing” with your own custom order status label as well.

// Add custom WooCommerce order status - "Processing"
function tt_new_processing_order_status() {
    register_post_status( 'wc-processing', array(
            'label' => _x( 'Processing', 'Order Status', 'woocommerce' ),
            'public' => true,
            'exclude_from_search' => false,
            'show_in_all_admin_list' => true,
            'show_in_admin_status_list' => true,
            'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'woocommerce' )
        )
    );
}
add_action( 'init', 'tt_new_processing_order_status' );


function tt_invoice_order_status( $order_statuses ){
    $order_statuses['wc-processing'] = _x( 'Processing', 'Order Status', 'woocommerce' );
    return $order_statuses;

}
add_filter( 'wc_order_statuses', 'tt_invoice_order_status' );


function tt_custom_in_bulk_actions() {
    global $post_type;

    if( 'shop_order' == $post_type ) {
        ?>
            <script type="text/javascript">
                jQuery(document).ready(function(){
                    jQuery('<option>').val('mark_processing').text('<?php _e( 'Change Status to Processing','woocommerce' ); ?>').appendTo("select[name='action']");
                    jQuery('<option>').val('mark_processing').text('<?php _e( 'Change Status to Processing','woocommerce' ); ?>').appendTo("select[name='action2']");
                });
            </script>
        <?php
    }
}
add_action( 'admin_footer', 'tt_custom_in_bulk_actions' );

Leave a Comment