You are getting a 404 error because woocommerce_get_product_thumbnail()
is not finding any image to return.
I'm assuming you want to download the featured image for the product, so you should be using wp_get_attachment_image_src()
instead of woocommerce_get_product_thumbnail()
, so change your code to:
<div class="Downloads">
<h3>Download image</h3>
<?php
// replace $postID with your post id variable
// change the 2nd parameter to specify the size of the image to get:
$image_attrib = wp_get_attachment_image_src( get_post_thumbnail_id($postID),'full');
?>
<a href="<?php echo image_attrib[0]; ?>">
<img src="<?php bloginfo ('template_url' )?>/img/downloadForWeb.png" alt="Download for web" />
</a>
</div>
If that doesn't work, I'm not sure how much more we can help without seeing more of the relevant source code. As you are already displaying the photo on the page, check the code that displays it to see how it's retrieving the correct url and use it.
NOTE: Your code is trying to display an image (downloadForWeb.png) as the link to download the main image. However downloadForWeb.png doesn't exist at the url in the code, so you are seeing the text "Download for web" instead. You should either fix the url or just use a text link.