简体   繁体   English

WooCommerce 如何删除订单操作 (WordPress)

[英]WooCommerce how to remove order actions (WordPress)

When you view an order in back-end there is a drop down list a the right side "Order actions".当您在后端查看订单时,右侧有一个下拉列表“订单操作”。 I was wondering how to remove some of these actions?我想知道如何删除其中一些操作? I just need "Resend Processing order" - everything else should be removed.我只需要“重新发送处理订单”——其他所有内容都应该被删除。

截屏

I have done a Google-search but mostly the results show how to add custom order actions and not how to remove them.我进行了 Google 搜索,但大部分结果显示了如何添加自定义订单操作,而不是如何删除它们。

Thanks!谢谢!

add_filter( 'woocommerce_order_actions', 'woocommerce_remove_order_actions' );
function woocommerce_remove_order_actions( $order_emails ) {
    unset($order_emails['regenerate_download_permissions']);
    return $order_emails;
}

I see that this has not been resolved 100%.我看到这还没有得到 100% 的解决。 You can use the woocommerce_order_actions hook and unset elements you don't want to see in that dropdown.您可以使用 woocommerce_order_actions 挂钩和取消设置您不想在该下拉列表中看到的元素。

well, this should do it.好吧,这应该可以做到。

add_filter( 'woocommerce_resend_order_emails_available', 'woocommerce_resend_order_emails_available' );
function woocommerce_resend_order_emails_available( $order_emails ) {

    //$order_emails has array( 'new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice' );

    $remove = array( 'new_order', 'cancelled_order', 'customer_completed_order', 'customer_invoice' ); // remove these 4
    $order_emails = array_diff( $order_emails, $remove );

    return $order_emails;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM