隐藏 Woocommerce 管理员编辑订单页面中的一些按钮

Hide some buttons in Woocommerce Admin edit order pages

我快被这个搞疯了,我整天都在寻找解决方案。我知道 display: none; css 应该可以解决,但我就是无法让它工作。

我正在尝试删除 "Add Product(s)"、"Add fee" 和 "Add shipping" 按钮。

您应该尝试在隐藏一些订单按钮的 admin_head 操作中挂接此自定义函数:

add_action( 'admin_head', 'hidding_some_order_buttons' );
function hidding_some_order_buttons() {
    echo '<style>
        .post-type-shop_order .wc-order-add-item > button.add-order-item,
        .post-type-shop_order .wc-order-add-item > button.add-order-fee,
        .post-type-shop_order .wc-order-add-item > button.add-order-shipping{
            display: none !important;
        }
    </style>';
}

代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。

已测试并有效。你会得到这样的东西: