Skip to content

Instantly share code, notes, and snippets.

@Musilda
Last active January 2, 2020 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Musilda/6af4b93fa80fe4c20966b8976a1b51b8 to your computer and use it in GitHub Desktop.
Save Musilda/6af4b93fa80fe4c20966b8976a1b51b8 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'woocommerce_register_shop_order_post_statuses', 'musilda_register_custom_order_status' );
function musilda_register_custom_order_status( $order_statuses ){
$order_statuses['wc-custom-status'] = array(
'label' => _x( 'Custom Status', 'Order status', 'woocommerce' ),
'public' => false,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Custom Status <span class="count">(%s)</span>', 'Custom Status <span class="count">(%s)</span>', 'woocommerce' ),
);
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'musilda_show_custom_order_status' );
function musilda_show_custom_order_status( $order_statuses ) {
$order_statuses['wc-custom-status'] = _x( 'Custom Status', 'Order status', 'woocommerce' );
return $order_statuses;
}
add_filter( 'bulk_actions-edit-shop_order', 'musilda_custom_order_status_bulk' );
function musilda_custom_order_status_bulk( $bulk_actions ) {
$bulk_actions['mark_custom-status'] = 'Change status to custom status';
return $bulk_actions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment