2015-11-04 43 views
1

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

有一个函数“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编码是基本的(IM仍然在学习),我不知道从哪里开始与所有这些代码。如何使用上述功能从销售报告中删除暂停订单?

回答

1

我看到woocommerce主报表类WC_Admin_Report上线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; 
} 
加入这样的过滤器更改为报告的默认订单状态
+0

你有这个更新的版本?似乎无法让它与Woo 2.6.11一起工作。谢谢! – Jambo