Fix; prevent duplicate queries

This commit is contained in:
Mike Jolley 2017-02-08 16:19:01 +00:00
parent b391e64453
commit c63cec32b9
1 changed files with 7 additions and 5 deletions

View File

@ -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;
}