Solved!
I tried to work out Snippets and asked ChatGPT for the code;
add_action( 'woocommerce_new_order', 'send_new_order_emails', 10, 1 );
function send_new_order_emails( $order_id ) {
$emails = array( 'email1@example.com', 'email2@example.com' ); // Add your email addresses here
$subject = 'New Order Notification';
$message = 'A new order has been placed on your website. Order ID: ' . $order_id;
foreach ( $emails as $email ) {
wp_mail( $email, $subject, $message );
}
}
Then the mails didn’t came through and I asked ChatGPT why. It told me that it could be; ”Check that the wp_mail function is enabled on your server. Some web hosts disable this function for security reasons. You can try using a plugin like WP Mail SMTP to configure SMTP settings and make sure emails are being sent.” And so I did.
I installed WP Mail SMTP, really easy how to connect gmail to their system. After this I tested a new order and I got the Email twice! One true copy and one from Code Snippets. The copy came from ‘Multiple Email Recipients – WC’ which i thought didn’t work.
Didn’t really need Code Snippets in the end it was the SMTP why the mails from ‘Multiple Email Recipients – WC’ did work.
Hope this will help others.
Hi @user63854f8acfeb5
Thanks for reaching out!
I’m glad you were able to find a solution to your inquiry here and thanks for sharing it with the community too! 🙂
I will be marking this thread as resolved. Should you have further inquiries, kindly create a new topic here.
Thanks!