Custom colors for custom order statuses in WooCommerce

Categories: CMS, Wordpress

Add the following code and replace your order names and color codes as needed:

add_action('admin_head', 'styling_admin_order_list' );
function styling_admin_order_list() {
    global $pagenow, $post;

    if( $pagenow != 'edit.php') return; // Exit
    if( get_post_type($post->ID) != 'shop_order' ) return; // Exit

    // HERE we set your custom status
    $order_status1 = 'Pending Stock'; // <==== HERE
    $order_status2 = 'Sending Cex'; // <==== HERE
    $order_status3 = 'Cancelled'; // <==== HERE

    ?>
    <style>
        .order-status.status-<?php echo sanitize_title( $order_status1 ); ?> {
            background: #d7f8a7;
            color: #000000;
        }

        .order-status.status-<?php echo sanitize_title( $order_status2 ); ?> {
            background: #ADD8E6!important;
            color: #000000;
        }

        .order-status.status-<?php echo sanitize_title( $order_status3 ); ?> {
            background: #F08080!important;
            color: #000000;
        }
		
    </style>
    <?php
}

More statuses can be added if they exist.

«
»