Uncaught Error: Call to undefined method WC_Order_Refund::get_payment_method()
-
I am trying to get all orders between a certain date period with wc_get_orders(), this works:
$args = array(
‘status’ => ‘wc-completed’,
‘date_created’ => $dateRange,
);
$orders = wc_get_orders($args);I then loop through the orders which are completed (which would mean that they do have a payment method attached, or so I think), and get various data:
foreach ($orders as $order) {
$total = $order->get_total();
$payment_method = $order->get_payment_method();
}However, this gives me an **Uncaught Error: Call to undefined method WC_Order_Refund::get_payment_method()**
I assume this happens because the order does not have a payment method attached? Can anybody give me anysight? Or parameters that I can add in the query so I only retrieve orders that are paid.
- The topic ‘Uncaught Error: Call to undefined method WC_Order_Refund::get_payment_method()’ is closed to new replies.