Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi Luis,
    Yes this is possible but does require some custom code in your theme functions (functions.php) – read this if you haven’t edited that file before.

    add_action("woocommerce_order_status_completed", "wpo_wcpdf_save_pdf", 10, 2);
    function wpo_wcpdf_save_pdf ( $order_id ) {
    	global $wpo_wcpdf;
    	$order_ids = (array) $order_id;
    
    	// create pdf data
    	$template_type = 'invoice';
    	$pdf = $wpo_wcpdf->export->get_pdf( $template_type, $order_ids );
    
    	// save pdf
    	$filename = $this->build_filename( $template_type, $order_ids, 'download' );
    	$pdf_folder = 'full/server/path/to/your/folder/';
    	$pdf_path = $pdf_folder . $pdf_filename;
    	file_put_contents ( $pdf_path, $pdf );
    }

    You may also want to consider our Dropbox extension, which automates all of this for you.

    Hope that helps!

    Ewout

Viewing 1 replies (of 1 total)

The topic ‘Create PDF on complete order status’ is closed to new replies.