Hi,
Thank’s Ewout,
This is very useful for me.
There are one change in your code that is
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 = 'some/path/on/your/site/'.$order_id.'.pdf';
file_put_contents ( $pdf_path, $invoice );
unset($invoice);
echo '<a href="the/url/to/your/path/<?php echo $order_id; ?>.pdf">Download PDF Invoice</a>';
}
to
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 = 'some/path/on/your/site/'.$order_id.'.pdf';
file_put_contents ( $pdf_path, $invoice );
unset($invoice);
echo '<a href="the/url/to/your/path/'.$order_id.'.pdf">Download PDF Invoice</a>';
}
But, Very Very thanks for valuable help.