Hey, thanks a lot for the input, I’ve adjusted the Germanized settings and now the invoice PDF is being generated and attached to the transactional email when the order confirmation is being sent.
The problem, however is with the additional information I’m trying to add to the email. I’ve modified the customer-processing-order.php template by adding a bit of text and some invoice information. My custom text is showing, but the invoice information is not. Seems like at the time of the creation of the email, I’m not able to grab the invoice object properly or it’s just not ready to use yet at that point. Which is weird, because the PDF attachment of the invoice is in the email, but the information I’m trying to access inside the template is not showing. Here’s a short example of what I’ve tried using:
$invoice = wc_gzdp_get_order_last_invoice($order);
if ($invoice) {
$invoice_number = $invoice->get_formatted_number();
}
But wc_gzdp_get_order_last_invoice($order) returns empty. Only after I try to Resend the order confirmation email manually, from the admin dropdown in the backend of the edit order page, does the conditional check pass and the formatted invoice number shows in the email that gets sent.
I’ve also tried to use the Action Scheduler and send the order confirmation email after a 2-3 minutes delay once an order has been placed, but even then it’s the same result. The manual trigger I’m using after the delay is:
WC()->mailer()->get_emails()['WC_Email_Customer_Processing_Order']->trigger($order_id);
I’m not sure if I need to trigger some specific variation of the Germanized customer order confirmation email like WC_GZDP_Email_Customer_Order_Confirmation or use a different function than wc_gzdp_get_order_last_invoice($order) to be able to access and work with the invoice information inside the customer-processing-order.php template when the order is placed initially. Hoping you can please help me or give me some directions if you have an idea.