Home Woocommerce How to add download pdf link in woocommerce single product page?

How to add download pdf link in woocommerce single product page?

by therichpost
4 comments
woocommerce

Hello to all, welcome to therichpost.com. In this post, I will tell you, How to add download pdf link in woocommerce single product page?

I am showing download pdf link on single product page with help of woocommerce hook.

Here is the woocommerce hook and please add carefully into your theme’s functions.php file:

add_action('woocommerce_before_single_product_summary','download_pdf',11);
function download_pdf()
{
    echo "<a href='add_your_pdf_link' target='_blank'>Download PDF</a>"; 
}

 

If you have any query regarding this then please do comment below.

Jassa

Thank you

You may also like

4 comments

9t9sol January 27, 2021 - 5:34 am

hi i used your code in themes functions.php but it is not showing download pdf button in product details page,

do i need to modify some others files too ?

Reply
Ajay Malhotra January 27, 2021 - 5:41 am

Try this:
add_action( ‘woocommerce_before_single_product_summary’, ‘download_pdf’, 10 );
function download_pdf()
{
return “Download PDF“;
}

Reply
Robert Phillips-Legge February 2, 2022 - 3:41 am

Is there a way of turning this into a shortcode so that you can enter it into a template?

Reply
Ajay Malhotra February 2, 2022 - 4:56 am

yes we can.

Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.