I need to hide orders with a specific status in the WooCommerce admin orders list. (wp-admin/edit.php?post_type=shop_order).
CSS won't work as if the user only shows 20 rows, there might be a page with no results as many orders might have this status.
I tried the following function:
add_action('wc_order_statuses', 'my_statuses');
function my_statuses($order_statuses) {
unset($order_statuses['wc-my_status']);
return $order_statuses;
}
...but that made conflict with my function (below) on the Thank you page which no longer changed the order status to my custom status, probably because the function mentioned above removes it.
add_action( 'woocommerce_thankyou', 'woocommerce_thankyou_change_order_status', 10, 1 );
function woocommerce_thankyou_change_order_status( $order_id ){
if( // my custom code ) {
$order->update_status( 'my_status' );
}
}
Is there no easy way to hide orders with my_status from the order list in WooCommerce admin panel?
wc_order_statuses
action hook is used to add/remove order status in the dropdown menu @ single order, NOT to hide order status from WooCommerce admin order list and also does not affect thewoocommerce_thankyou
hook – 7uc1f3r