WC_Order::get_refunds()publicWC 2.2

Get order refunds.

Метод класса: WC_Order{}

Хуков нет.

Возвращает

Массив. of WC_Order_Refund objects

Использование

$WC_Order = new WC_Order();
$WC_Order->get_refunds();

Список изменений

С версии 2.2 Введена.

Код WC_Order::get_refunds() WC 8.7.0

public function get_refunds() {
	$cache_key   = WC_Cache_Helper::get_cache_prefix( 'orders' ) . 'refunds' . $this->get_id();
	$cached_data = wp_cache_get( $cache_key, $this->cache_group );

	if ( false !== $cached_data ) {
		return $cached_data;
	}

	$this->refunds = wc_get_orders(
		array(
			'type'   => 'shop_order_refund',
			'parent' => $this->get_id(),
			'limit'  => -1,
		)
	);

	wp_cache_set( $cache_key, $this->refunds, $this->cache_group );

	return $this->refunds;
}