• Hi,

    For my Woocommerce I made a plugin that adds an extra order status.
    This works just fine.
    But I also tried to give the new status a nice colour. But this does not work.
    Can anyone help me out with the colour?

    function wpblog_wc_register_post_statuses() {
    	register_post_status( 'wc-shipping-progress', array(
    		'label' => _x( 'In productie', 'WooCommerce Order status', 'text_domain' ),
    		'public' => true,
    		'exclude_from_search' => false,
    		'show_in_admin_all_list' => true,
    		'show_in_admin_status_list' => true,
    		'label_count' => _n_noop( 'Approved (%s)', 'Approved (%s)', 'text_domain' )
    ) );
    }
    
    add_filter( 'init', 'wpblog_wc_register_post_statuses' );
    
    function wpblog_wc_add_order_statuses( $order_statuses ) {
    	$order_statuses['wc-shipping-progress'] = _x( 'In productie', 'WooCommerce Order status', 'text_domain' );
    return $order_statuses;
    }
    
    add_filter( 'wc_order_statuses', 'wpblog_wc_add_order_statuses' );
    
    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 = 'In productie'; // <==== HERE
    ?>
    <style>
        .order-status.status-<?php echo sanitize_title( $order_status ); ?> {
            background: #d7f8a7;
            color: #0c942b;
        }
    </style>
    <?php
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom order status edit colour’ is closed to new replies.