【问题标题】:exclude "On Hold" orders from Woo Sales reports从 Woo 销售报告中排除“暂停”订单
【发布时间】:2015-11-04 11:43:52
【问题描述】:

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

这里有一个函数“exclude_from_order_sales_reports” - https://docs.woothemes.com/wc-apidocs/function-wc_register_order_type.html - 它将从销售报告中排除帖子类型。

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

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

【问题讨论】:

    标签: wordpress woocommerce report


    【解决方案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;
    }
    

    【讨论】:

    • 你有这个的更新版本吗?似乎无法让它与 Woo 2.6.11 一起使用。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-16
    • 2018-09-10
    • 1970-01-01
    • 2017-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多