In Woocommerce(*My Account page) I can see now an unordered list with all the downloads available, like:
<ul class="digital-downloads">
<li><a href="#">Product 1 - File</a></li>
<li><a href="#">Product 1 - Another File</a></li>
<li><a href="#">Product 2 - File</a></li>
<li><a href="#">Product 2 - Another File</a></li>
<li><a href="#">Product 3 - File</a></li>
<li><a href="#">Product 3 - Another File</a></li>
</ul>
How can I group the downloads by product?, like:
<ul class="digital-downloads">
<li>
<span>Product 1</span>
<ul>
<li><a href="#">File</a></li>
<li><a href="#">Another File</a></li>
</ul>
</li>
<li>
<span>Product 2</span>
<ul>
<li><a href="#">File</a></li>
<li><a href="#">Another File</a></li>
</ul>
</li>
<li>
<span>Product 3</span>
<ul>
<li><a href="#">File</a></li>
<li><a href="#">Another File</a></li>
</ul>
</li>
</ul>
The code from my theme/woocommerce/my-account/my-downloads.php:
<ul class="digital_downloads">
<?php foreach ( $downloads as $download ) : ?>
<li>
<?php
do_action( 'woocommerce_available_download_start', $download );
echo apply_filters( 'woocommerce_available_download_link', '<a href="' . esc_url( $download['download_url'] ) . '">' . $download['download_name'] . '</a>', $download );
do_action( 'woocommerce_available_download_end', $download );
?>
</li>
<?php endforeach; ?>
</ul>
I know, I am answering this question very late but I am posting an answer for this just in case anyone else is looking out for the answer.
Please create a child theme and in that child theme create file /woocommerce/my-account/my-downloads.php. Add following content in that file
Above code is tested with WooCommerce 2.1.12.
The code above seemed to close out the child list too early. So if I had two downloads under one product it would display as
Instead I just changed the html markup to divs. This might not be semantically as correct but got the job done and was more simple to code.
This was done in WooCommerce 2.5.2
i fix
Change
the line
to