Add Instant Download Button to Virtual Products in WooCommerce

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.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.