Hello People,
I have used the same code but still not able to generate pdf.
Its says “File Not Found”
<?php
add_action( ‘woocommerce_thankyou’, ‘generate_thank_you_pdf_invoice’, 10, 1 );
function generate_thank_you_pdf_invoice( $order_id ) {
global $wpo_wcpdf;
$invoice = $wpo_wcpdf->export->get_pdf( ‘invoice’, (array) $order_id );
$pdf_path = ‘/var/www/html/wpdemo/’.$order_id.’.pdf’;
file_put_contents ( $pdf_path, $invoice );
unset($invoice);
echo ‘Download PDF Invoice‘;
}
?>
Website url