从Woo Sales报告中排除“暂停”订单

时间:2015-11-04 11:43:52

标签: wordpress woocommerce report

我想从woocommerce销售报告中删除/排除订单状态为“暂停”的任何订单。默认情况下,暂停订单包含在销售报告中。

此处有一个“exclude_from_order_sales_reports”功能 - https://docs.woothemes.com/wc-apidocs/function-wc_register_order_type.html - 将从销售报告中排除某个帖子类型。

此处处理订单类型和订单状态 - https://docs.woothemes.com/wc-apidocs/source-function-wc_register_order_type.html#167-221

不幸的是我的PHP编码是基本的(我还在学习),我不知道从哪里开始使用所有这些代码。如何使用上述功能从销售报告中删除保留订单?

1 个答案:

答案 0 :(得分:1)

我在WC_Admin_Report行的woocommerce主报告课67上看到他们有这样的过滤器$order_status = apply_filters( 'woocommerce_reports_order_statuses', $order_status );

所以我认为您可以通过在functions.php上添加这样的过滤器轻松更改报告的默认订单状态

add_filter( 'woocommerce_reports_order_statuses', 'my_custom_order_status_for_reports', 10, 1 );
function my_custom_order_status_for_reports($order_statuses){
    $order_statuses = array('completed'); // your order statuses for reports

    return $order_statuses;
}