WordPress at a glance
function is not described

WC_API_Orders::get_order_refunds() public WC 2.2

Get the order refunds for an order

{} It's a method of the class: WC_API_Orders{}

Return

Array|WP_Error.

Usage

$WC_API_Orders = new WC_API_Orders();
$WC_API_Orders->get_order_refunds( $order_id, $fields );
$order_id(string) (required)
order ID
$fields(string|null)
fields to include in response

Changelog

Since 2.2 Introduced.

Code of WC_API_Orders::get_order_refunds() WC 5.0.0

<?php
public function get_order_refunds( $order_id, $fields = null ) {

	// Ensure ID is valid order ID
	$order_id = $this->validate_request( $order_id, $this->post_type, 'read' );

	if ( is_wp_error( $order_id ) ) {
		return $order_id;
	}

	$refund_items = wc_get_orders( array(
		'type'   => 'shop_order_refund',
		'parent' => $order_id,
		'limit'  => -1,
		'return' => 'ids',
	) );
	$order_refunds = array();

	foreach ( $refund_items as $refund_id ) {
		$order_refunds[] = current( $this->get_order_refund( $order_id, $refund_id, $fields ) );
	}

	return array( 'order_refunds' => apply_filters( 'woocommerce_api_order_refunds_response', $order_refunds, $order_id, $fields, $refund_items, $this ) );
}