[ad_1]
[ad_2]
Hello,
I’m looking for a solution in order to create and attach to each product a pdf file that can be downloaded. I don’t want to attach a pdf file to each product manually, i just want something such as when a client clicks the download button a pdf like version of the product page can be downloaded/exported in pdf format.
Thanks in advance
This will open the ‘print’ window, not sure if it is what you are looking:
function add_print_button_to_product_page() {
?>
<button id=”print-pdf” class=”button alt”>Print PDF</button>
<script>
document.getElementById(‘print-pdf’).addEventListener(‘click’, function() {
window.print();
});
</script>
<?php
}
add_action(‘woocommerce_single_product_summary’, ‘add_print_button_to_product_page’, 35);