You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WooCommerce使用自定义订单状态时订单数量编辑箭头消失如何解决

WooCommerce自定义订单状态无法编辑商品解决方案

你遇到的编辑控件消失问题,是因为WooCommerce默认仅对内置的待付款、处理中等状态开放编辑权限,自定义状态默认会被判定为不可编辑,和你现有注册状态的代码无关,只需要额外添加一段过滤器代码,将你自定义的wc-to-order状态加入可编辑列表即可:

// 自定义To order状态支持订单编辑
add_filter( 'wc_order_is_editable', 'allow_to_order_status_edit', 10, 2 );
function allow_to_order_status_edit( $editable, $order ) {
    // 注意get_status()返回的状态自动去除wc-前缀,直接写to-order即可
    if ( $order->get_status() === 'to-order' ) {
        return true;
    }
    return $editable;
}

将上述代码加入主题functions.php或者自定义代码片段插件中,刷新订单编辑页即可看到编辑箭头恢复显示,可正常修改商品数量、增减商品、修改订单金额等操作。

内容的提问来源于stack exchange,提问作者Vladimir Kyatipov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.13 03:57:04