Naast in behandeling of afgerond een extra status toevoegen in WooCommerce orders.

Voeg deze code toe aan functions.php van je thema of Code Snippets.


// New order status AFTER woo 2.2
add_action( 'init', 'register_my_new_order_statuses' );

function register_my_new_order_statuses() {
register_post_status( 'wc-invoiced', array(
'label' => _x( 'In productie', 'Order status', 'woocommerce' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'In productie <span class="count">(%s)</span>', 'In productie<span class="count">(%s)</span>', 'woocommerce' )
) );
}

add_filter( 'wc_order_statuses', 'my_new_wc_order_statuses' );

// Register in wc_order_statuses.
function my_new_wc_order_statuses( $order_statuses ) {
$order_statuses['wc-invoiced'] = _x( 'In productie', 'Order status', 'woocommerce' );

return $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 = 'invoiced'; // <==== HERE
?>
<style>
    .order-status.status-<?php echo sanitize_title( $order_status ); ?> {
        background: #ad7fb0;
        color: #fff;
    }
</style>
<?php
}



Was dit antwoord nuttig? Ja Nee

Feedback versturen
Het spijt ons dat we u niet hebben kunnen helpen. Als u feedback geeft, kunnen we het artikel verbeteren.