WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Order::get_downloadable_items() WC 3.2.0

Get downloads from all line items for this order.

Это метод класса: WC_Order

Хуки из метода
Возвращает

Массив.

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

$WC_Order = new WC_Order();
$var = $WC_Order->get_downloadable_items();

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

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

Код WC Order::get downloadable items: woocommerce/includes/class-wc-order.php WC 3.9.0

<?php
public function get_downloadable_items() {
	$downloads = array();

	foreach ( $this->get_items() as $item ) {
		if ( ! is_object( $item ) ) {
			continue;
		}

		// Check item refunds.
		$refunded_qty = abs( $this->get_qty_refunded_for_item( $item->get_id() ) );
		if ( $refunded_qty && $item->get_quantity() === $refunded_qty ) {
			continue;
		}

		if ( $item->is_type( 'line_item' ) ) {
			$item_downloads = $item->get_item_downloads();
			$product        = $item->get_product();
			if ( $product && $item_downloads ) {
				foreach ( $item_downloads as $file ) {
					$downloads[] = array(
						'download_url'        => $file['download_url'],
						'download_id'         => $file['id'],
						'product_id'          => $product->get_id(),
						'product_name'        => $product->get_name(),
						'product_url'         => $product->is_visible() ? $product->get_permalink() : '', // Since 3.3.0.
						'download_name'       => $file['name'],
						'order_id'            => $this->get_id(),
						'order_key'           => $this->get_order_key(),
						'downloads_remaining' => $file['downloads_remaining'],
						'access_expires'      => $file['access_expires'],
						'file'                => array(
							'name' => $file['name'],
							'file' => $file['file'],
						),
					);
				}
			}
		}
	}

	return apply_filters( 'woocommerce_order_get_downloadable_items', $downloads, $this );
}