WC_Order::get_refunds PHP Method

get_refunds() public method

Get order refunds.
Since: 2.2
public get_refunds ( ) : array
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));
        return $this->refunds;
    }

Usage Example

 /**
  * Add credit note email to order actions list
  */
 public function pro_email_order_actions($available_emails)
 {
     global $post_id;
     $order_notification_settings = get_option('woocommerce_pdf_order_notification_settings');
     if (isset($order_notification_settings['recipient']) && !empty($order_notification_settings['recipient'])) {
         // only add order notification action when a recipient is set!
         $available_emails[] = 'pdf_order_notification';
     }
     if (version_compare(WOOCOMMERCE_VERSION, '2.2', '>=')) {
         $order = new WC_Order($post_id);
         $refunds = $order->get_refunds();
         if (!empty($refunds)) {
             $available_emails[] = 'customer_credit_note';
         }
     }
     return $available_emails;
 }
All Usage Examples Of WC_Order::get_refunds
WC_Order