• Resolved almighty

    (@almighty)


    Hello!

    We try set up WooCommerce for our site and have a question: Is it possible to overwrite PDF invoice plugin offers? We already use an ERP from where invoices are issued and would like to know if we can upload a certain PDF invoice and then send this one to user as a receipt.

    Thanks,
    Giorgos

    The page I need help with: [log in to see the link]

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

    (@pomegranate)

    Hello Giorgos,
    This plugin creates the PDF file on the fly, based on order data, so unfortunately it’s not possible to replace an actual PDF file with another. Theoretically you could use the wpo_wcpdf_get_pdf filter (new in 2.2.0) to replace the generated PDF content with your own, but you’d need to create the code around that yourself. Here’s an example that should be a good start on this for a PHP developer:

    
    add_filter( 'wpo_wcpdf_get_pdf', 'wpo_wcpdf_replace_pdf', 10, 2 );
    function wpo_wcpdf_replace_pdf( $pdf_data, $document ) {
    	if ($document->get_type() == 'invoice') {
    		// locate your PDF file
    		// WC_Order object is loaded in $document->order
    		$pdf_file = '/path/to/your/pdf';
    		$pdf_data = file_get_contents($pdf_file);
    	}
    	return $pdf_data;
    }
    

    Hope that helps – good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Invoice from a third party app’ is closed to new replies.