小编Adi*_*Ali的帖子

在 WooCommerce 管理订单列表中批量操作添加自定义取消订单状态

我想取消管理订单列表中 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)

php wordpress woocommerce

3
推荐指数
1
解决办法
1949
查看次数

标签 统计

php ×1

woocommerce ×1

wordpress ×1