Please have a look at my sample product page:
http://snshpl.com.sg/product/swa-8003-t/
I’m currently using hooks to hardcode the download button (together with a disclaimer text) to appear right after all my products’ meta, this is the code added in my theme’s functions.php:
add_action('woocommerce_product_meta_end','disclaimer');
function disclaimer(){
echo '<br /><br /><a href="#" class="single_add_to_cart_button button
alt">Download</a><p id="disclaimer-text"><br /><br />*Color Disclaimer:
Due to the limitations of desktop scanners and the relative
inconsistencies of various display monitors, the colors you see on your
screen may not be a totally accurate reproduction of the actual product.
We strive to make our colors as accurate as possible, but screen images
are intended as a guide only and should not be regarded as absolutely
correct. If you would like to see a sample of any product shown on our
site, please call Customer Service at 6365 3383 or visit our contact
page.</p>';
}
My question is how do I extract the url of the image shown and add it to the link of the download button? I’ve tried various methods but not sure how to access the link which I know is extracted in the file product-image.php.
Thanks in advance!
If you’re on the single product page, you can add the featured image url to your custom button with
wp_get_attachment_url( get_post_thumbnail_id() );
In your example: