Hide bulk actions from admin orders list except for processing status filtered list

99 Views Asked by At

Is there any way to hide bulk actions from admin orders list except for processing status filtered list: post_status=wc-processing where I only want to show bulk actions?

I tried to use code from How to remove bulk actions from admin orders page, but it hides bulk actions from all orders lists.

What I want is to show bulk actions only for Processing status filtered list. Is it possible?

1

There are 1 best solutions below

0
LoicTheAztec On BEST ANSWER

Simply use the following to only show bulk actions on "Processing" status orders list:

add_filter( 'bulk_actions-edit-shop_order', 'bulk_actions_only_on_processing_orders_list', 100 );
function bulk_actions_only_on_processing_orders_list( $bulk_actions ) {
    if( ! (isset($_GET['post_status']) && $_GET['post_status'] === 'wc-processing') ) {
        $bulk_actions = array();
    }
    return $bulk_actions;
}

Code goes in functions.php file of your child theme (or in a plugin file). Tested and works.