From c63cec32b9fcd97d102713b53aad3200acce8fa4 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 8 Feb 2017 16:19:01 +0000 Subject: [PATCH] Fix; prevent duplicate queries --- includes/class-wc-order.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index 08be1765659..c1c560effb4 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -1469,11 +1469,13 @@ class WC_Order extends WC_Abstract_Order { * @return array of WC_Order_Refund objects */ public function get_refunds() { - $this->refunds = wc_get_orders( array( - 'type' => 'shop_order_refund', - 'parent' => $this->get_id(), - 'limit' => -1, - ) ); + if ( empty( $this->refunds ) ) { + $this->refunds = wc_get_orders( array( + 'type' => 'shop_order_refund', + 'parent' => $this->get_id(), + 'limit' => -1, + ) ); + } return $this->refunds; }