我想取消管理订单列表中 WooCommerce 上的所有选定订单。
我已经编写了代码但它不起作用
add_filter( 'bulk_actions-edit-shop_order', 'my_register_bulk_action' ); // edit-shop_order is the screen ID of the orders page
function my_register_bulk_action( $bulk_actions ) {
$bulk_actions['mark_change_status_to_cancelled'] = 'Order Cancel'; // <option value="mark_awaiting_shipment">Order Cancel</option>
return $bulk_actions;
}
/*
* Bulk action handler
* Make sure that "action name" in the hook is the same like the option value from the above function
*/
add_action( 'admin_action_mark_change_status_to_cancelled', 'my_bulk_process_custom_status' ); // admin_action_{action name}
function my_bulk_process_custom_status() {
// if an array with order IDs is not presented, …Run Code Online (Sandbox Code Playgroud)