Fix; prevent duplicate queries
This commit is contained in:
parent
b391e64453
commit
c63cec32b9
|
@ -1469,11 +1469,13 @@ class WC_Order extends WC_Abstract_Order {
|
||||||
* @return array of WC_Order_Refund objects
|
* @return array of WC_Order_Refund objects
|
||||||
*/
|
*/
|
||||||
public function get_refunds() {
|
public function get_refunds() {
|
||||||
|
if ( empty( $this->refunds ) ) {
|
||||||
$this->refunds = wc_get_orders( array(
|
$this->refunds = wc_get_orders( array(
|
||||||
'type' => 'shop_order_refund',
|
'type' => 'shop_order_refund',
|
||||||
'parent' => $this->get_id(),
|
'parent' => $this->get_id(),
|
||||||
'limit' => -1,
|
'limit' => -1,
|
||||||
) );
|
) );
|
||||||
|
}
|
||||||
return $this->refunds;
|
return $this->refunds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue