Awesome! I will try this out 🙂
Thanks for the quick and solid advice!
Greets
Hi there!
Sorry to open this thread again. I was wondering, how I use the Class object returned from wcpdf_get_document.
In my case, I need to trigger the PDF generation if my conditional is met. So if vat number is filled in in Checkout, I want to add the PDF attachment to the customer order mail.
The steps where I need some help are in the code comments below. Could you please help me on this?
Anyhow, loving the plugin tho 🙂
function xyz_checkout_fields_validation($order_id){
if(isset($_POST['vat_number'])){
$order = wc_get_order( $order_id );
$invoice = wcpdf_get_document( 'invoice', $order, true );
// $pdf = generatePDF($invoice)
// add $pdf as attachment
}
}