Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter alpeshkumar.mca

    (@alpeshkumarmca)

    @dangoodman

    it’s noted. Thanks for the quick update.

    Thread Starter alpeshkumar.mca

    (@alpeshkumarmca)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)