I'm having trouble tracking down the correct hook function arguments to modify/add email content for the (WooCommerce Subscriptions-specific) 'customer_renewal_invoice' and 'processing_renewal_order' email IDs within the 'woocommerce_email_order_details' hook.
I have this working (email content modification, that is) for the standard WooCommerce order emails, but according to LoicTheAztec (Get the email id in Woocommerce emails), the Subscriptions plugin uses different hook function arguments; I just don't know what those are.
Here is a simplified version of what I have in place:
add_action ('woocommerce_email_order_details', 'custom_email_notification', 5, 4);
function custom_email_notification( $order, $sent_to_admin, $plain_text, $email ){
if ( 'customer_processing_order' == $email->id || 'customer_invoice' == $email->id || 'customer_on_hold_order' == $email->id || 'customer_renewal_invoice' == $email->id || 'processing_renewal_order' == $email->id ){
echo "Extra content here";
}
}
The first three "standard"/WooCommerce email IDs engage properly, but the last two (which are specific to the WooCommerce Subscriptions plugin) never engage/trigger; I know this is because my hook arguments are incorrect, but I do not know how to correct them.
I feel the essence of the information I need is mentioned in these other posts, but I can't quite put all of the pieces together; listed in order of perceived relevance:
https://stackoverflow.com/a/42097450
https://stackoverflow.com/a/31677646
WooCommerce Subscription Cancellation Email to Customer
My life in continually made easier/bearable by the incredible help from the users here on StackOverflow; thank you all for that, and thank you in advance for any help you can provide with this issue.
I think you probably actually want woocommerce_subscriptions_email_order_details
, it appears to be called from both emails you want (templates/emails/customer-renewal-invoice.php and templates/emails/customer-processing-renewal-order.php). In both of those it receives $order, $sent_to_admin, $plain_text, $email
. But if you want to handle any other cases, sometimes it's called in other places with $subscription, $sent_to_admin, $plain_text, $email
.