Hi, @maraltto,
Actually, I think both tasks are already doable with the plugin.
Custom email recipients
You can use the woocommerce_email_recipient_alg_wc_custom
filter, for example:
add_filter( 'woocommerce_email_recipient_alg_wc_custom', function ( $recipient, $_object, $email ) {
$users = get_users( array( 'role__in' => array( 'administrator', 'shop_manager' ) ) );
$emails = implode( ',', array_unique( wp_list_pluck( $users, 'user_email' ) ) );
return $emails;
}, 10, 3 );
This example will set “Custom email?#1” recipients to all users with?administrator
?or?shop_manager
?user roles. To set it for a different custom email (e.g., “Custom email?#2”), you need to replace?woocommerce_email_recipient_alg_wc_custom
?with?woocommerce_email_recipient_alg_wc_custom_2
, etc.
PHP in emails
One option would be to use the alg_wc_custom_emails_content
filter, for example:
add_filter( 'alg_wc_custom_emails_content', function ( $content, $email, $order, $user, $product ) {
if ( 1 == $email->alg_wc_ce_id ) { // for the "Custom email #1"
return 'Your custom content';
}
return $content;
}, 10, 5 );
Another option – modify the email template directly by copying it from custom-emails-for-woocommerce/templates/emails/alg-wc-custom-email.php to yourtheme/woocommerce/emails/alg-wc-custom-email.php.
Please give it a try and let me know what you think.