With the new woo orders screen, the old color status icons are now gone and replaced with a large status button with a colored background.
Processing is green, Completed is blue, Cancelled is grey etc.
I have a custom order status in woocommerce orders called: In Progress. Custom order statuses seem to also be given just a default grey color background. I would like to assign a color background to my custom order status. I have tried to find a code snippet in order to do this, but have had no luck.
You can set CSS color and background color to your custom order status displayed in admin order list this way:
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_status = 'Dispatched'; // <==== HERE
?>
<style>
.order-status.status-<?php echo sanitize_title( $order_status ); ?> {
background: #d7f8a7;
color: #0c942b;
}
</style>
<?php
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With