WC_Abstract_Legacy_Order::display_item_downloads PHP Method

display_item_downloads() public method

Display download links for an order item.
public display_item_downloads ( array $item )
$item array
    public function display_item_downloads($item)
    {
        wc_deprecated_function('display_item_downloads', '2.7', '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++;
                $prefix = count($download_files) > 1 ? sprintf(__('Download %d', 'woocommerce'), $i) : __('Download', 'woocommerce');
                $links[] = '<small class="download-url">' . $prefix . ': <a href="' . esc_url($file['download_url']) . '" target="_blank">' . esc_html($file['name']) . '</a></small>' . "\n";
            }
            echo '<br/>' . implode('<br/>', $links);
        }
    }