【问题标题】:Select all woocommerce customers with pending orders选择所有有待处理订单的 woocommerce 客户
【发布时间】:2020-07-04 04:17:39
【问题描述】:

如何选择订单中所有处于待处理状态的 woocommerce 客户。我正在专门寻找客户列表和电子邮件,而不是特定订单。

所以我知道我可以通过以下方式获得所有挂单:

    $unpaid_orders = (array) wc_get_orders( array(
    'limit'        => -1,
    'status'       => 'pending',
    ));

但我只想拥有一组有待处理订单的客户。

【问题讨论】:

    标签: php wordpress woocommerce


    【解决方案1】:

    你做对了。您必须循环生成的订单数组 $unpaid_orders 以收集客户 ID。

    $customers = []; // Array to collect customer IDs
    $unpaid_orders = (array) wc_get_orders( array(
    'limit'        => -1,
    'status'       => 'pending',
    ));
    foreach ($unpaid_orders as $order) { // Looping all orders to fetch customer IDs
        array_push($customers, $order->get_customer_id());
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-20
      • 1970-01-01
      • 2017-06-16
      • 2021-06-04
      • 2013-02-16
      • 2022-01-08
      • 2017-04-23
      • 2022-10-05
      相关资源
      最近更新 更多