php - Woocommerce: Creating a download link to product image -


please have @ sample product page: http://snshpl.com.sg/product/swa-8003-t/

i'm using hooks hardcode download button (together disclaimer text) appear right after products' meta, code added in 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 limitations of desktop scanners , relative      inconsistencies of various display monitors, colors see on      screen may not totally accurate reproduction of actual product.      strive make our colors accurate possible, screen images      intended guide , should not regarded absolutely      correct. if see sample of product shown on our      site, please call customer service @ 6365 3383 or visit our contact      page.</p>'; } 

my question how extract url of image shown , add link of download button? i've tried various methods not sure how access link know extracted in file product-image.php.

thanks in advance!

if you're on single product page, can add featured image url custom button wp_get_attachment_url( get_post_thumbnail_id() );

in example:

add_action('woocommerce_product_meta_end','disclaimer');  function disclaimer(){     echo '<br /><br /><a href="'.wp_get_attachment_url( get_post_thumbnail_id() ).'" class="single_add_to_cart_button button          alt">download</a><p id="disclaimer-text"><br /><br />*color disclaimer:      due limitations of desktop scanners , relative      inconsistencies of various display monitors, colors see on      screen may not totally accurate reproduction of actual product.      strive make our colors accurate possible, screen images      intended guide , should not regarded absolutely      correct. if see sample of product shown on our      site, please call customer service @ 6365 3383 or visit our contact      page.</p>'; } 

Comments