I'd like to customise the recipient of a new order in WooCommerce. According to the documentation and various examples I can do this like so:
function wc_change_admin_new_order_email_recipient( $recipient, $order ) {
global $woocommerce;
//some code
return $recipient;
}
add_filter('woocommerce_email_recipient_new_order', 'wc_change_admin_new_order_email_recipient', 10, 2);
However I cannot get this filter to trigger on my local development machine, nor can I get the site to send order emails even with this code removed.
I have a working local debugger and the code stops at various points in the wc_email class, however it only gets to the get_recipient function when I change the admin email in the backend.
Here is what I have tried:
- turned all other plugins off
- made sure Wordpress, WooCommerce, Theme is up to date
- Some theme files are shown as not up to date, but admin-new-order.php does not show in this list
- admin-new-order.php in overrides folder is identical to WooCommerce version, so I have also tried to remove the override completely
- Lost password sends me an email on my local system (over the Internet), so email delivery is working
Is there a cron job used for delivery of the admin new order email, if so how can I trigger it?
Any other ideas?