March 07, 2018
If you’re offering free downloadable items on your website, and don’t require site visitors to register for access to the items, you can use the following snippet to add a download link to your single-product template.
Options would be to place it alongside the Add to Cart button, or to use it to replace the Add to Cart button for relevant products.
$downloads = $product->get_files(); foreach( $downloads as $key => $each_download ) { echo '<a href="'.$each_download["file"].'">Download</a>'; }
Sourced here.