Custom order status background button color in WooCommerce 3.3 admin order list

You can set CSS color and background color to your custom order status displayed in admin order list this way:

[php]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
}[/php]

Code goes in function.php file of your active child theme (or active theme). Tested and works.

 

[custom-related-posts title=”You may Also Like:” none_text=”None found” order_by=”title” order=”ASC”]

Leave a Comment