WC_Abstract_Legacy_Order::get_item_downloads() public WC 1.0
Get the downloadable files for an item in this order.
{} It's a method of the class: WC_Abstract_Legacy_Order{}
No Hooks.
Return
Array.
Usage
$WC_Abstract_Legacy_Order = new WC_Abstract_Legacy_Order(); $WC_Abstract_Legacy_Order->get_item_downloads( $item );
- $item(array) (required)
- -
Code of WC_Abstract_Legacy_Order::get_item_downloads() WC Abstract Legacy Order::get item downloads WC 5.0.0
public function get_item_downloads( $item ) {
wc_deprecated_function( 'WC_Order::get_item_downloads', '3.0', 'WC_Order_Item_Product::get_item_downloads' );
if ( ! $item instanceof WC_Order_Item ) {
if ( ! empty( $item['variation_id'] ) ) {
$product_id = $item['variation_id'];
} elseif ( ! empty( $item['product_id'] ) ) {
$product_id = $item['product_id'];
} else {
return array();
}
// Create a 'virtual' order item to allow retrieving item downloads when
// an array of product_id is passed instead of actual order item.
$item = new WC_Order_Item_Product();
$item->set_product( wc_get_product( $product_id ) );
$item->set_order_id( $this->get_id() );
}
return $item->get_item_downloads();
}