How can I attach a PDF invoice to my custom email template?
-
Hey im using the WooCommerce PDF Invoices & Packing Slips, and I need to attached the invoice to a custom email and i can′t find de way, this is my custom email function:
function virtual_sent($order_id, $checkout=null) {
global $woocommerce;
$order = new WC_Order( $order_id );
if($order->status === ‘virtual-shipment’ ) {//I TRIED THIS BUT IT DOESNT WORK
/*$invoice = new BEWPI_Invoice( $order->get_order_number() ); // use $order->id when using older WC version.
$invoice_path = $invoice->get_full_path();
$attachments[] = $invoice_path;*/// Create a mailer
$mailer = $woocommerce->mailer();$message_body = get_virtual_email_html( $order, $subject, $mailer );
$message = $message_body ;
$mailer->send( $order->billing_email, sprintf( __( “\xE2\x9C\x8A” ), $order->get_order_number() ), $message);
}
}
- The topic ‘How can I attach a PDF invoice to my custom email template?’ is closed to new replies.