I have a problem and it sounds stupid, but I\'m really stucked.
I need to send \"new order\" email also to customer. I tried adding function to functions.php file,
You do not need to do all these stuff again for sending multiple emails. You can simply add recipient to "New Order" email(with customer's email). Here is the code you can try:
get_items();
// check if a shipped product is in the order
foreach ( $items as $item ) {
$product = $order->get_product_from_item( $item );
// add our extra recipient if there's a shipped product - commas needed!
// we can bail if we've found one, no need to add the recipient more than once
if ( $product && $product->needs_shipping() ) {
$recipient .= ', warehouse-manager@example.com';
return $recipient;
}
}
return $recipient;
}
add_filter( 'woocommerce_email_recipient_new_order', 'sv_conditional_email_recipient', 10, 2 );