WC_Abstract_Legacy_Order::display_item_downloads( array $item )
Display download links for an order item.
Description Description
Parameters Parameters
- $item
-
(Required)
Source Source
File: includes/legacy/abstract-wc-legacy-order.php
public function display_item_downloads( $item ) { wc_deprecated_function( 'WC_Order::display_item_downloads', '3.0', 'wc_display_item_downloads' ); $product = $item->get_product(); if ( $product && $product->exists() && $product->is_downloadable() && $this->is_download_permitted() ) { $download_files = $this->get_item_downloads( $item ); $i = 0; $links = array(); foreach ( $download_files as $download_id => $file ) { $i++; /* translators: 1: current item count */ $prefix = count( $download_files ) > 1 ? sprintf( __( 'Download %d', 'woocommerce' ), $i ) : __( 'Download', 'woocommerce' ); $links[] = '<small class="download-url">' . esc_html( $prefix ) . ': <a href="' . esc_url( $file['download_url'] ) . '" target="_blank">' . esc_html( $file['name'] ) . '</a></small>' . "\n"; } echo '<br/>' . implode( '<br/>', $links ); } }