Find Jobs
Hire Freelancers

Fix my Woocommerce functions.php script

€25-35 EUR

Completed
Posted over 3 years ago

€25-35 EUR

Paid on delivery
The following script is adding an extra email recipient when product id 9515 is bought. So WooCommerce sends 2 emails, 1 to default recipient and 1 to second @gmail.com. What I need is to change this script to ONLY send to second @[login to view URL], so the default recipient does NOT receive any email. I just want the changed code, no site access is necessary, you will work it locally. -- add_filter( 'woocommerce_email_recipient_new_order', 'conditional_recipient_new_email_notification2', 15, 2 ); function conditional_recipient_new_email_notification2( $recipient, $order ) { if( is_admin() ) return $recipient; // (Mandatory to avoid backend errors) $targeted_id = 9515; // HERE define your targeted product ID $addr_email = 'second @[login to view URL]'; // Here the additional recipient // Loop through orders items foreach ($order->get_items() as $item_id => $item ) { if( $item->get_variation_id() == $targeted_id || $item->get_product_id() == $targeted_id ){ $recipient .= ', ' . $addr_email; break; // Found and added - We stop the loop } } return $recipient; }
Project ID: 27945531

About the project

9 proposals
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
€0 EUR in 2 days
5.0 (1024 reviews)
8.8
8.8
9 freelancers are bidding on average €30 EUR for this job
User Avatar
Hi, Change: $recipient .= ', ' . $addr_email; To: $recipient = $addr_email; It's nice if you accept my proposal. (even though I already solved your problem)
€25 EUR in 1 day
4.9 (56 reviews)
5.6
5.6
User Avatar
Hello, Good day. I have read your requirement. you want to send another mail for specific product id. I can able to fix this bug. Please hire me Thanks Mahmudul Hasan
€30 EUR in 2 days
5.0 (18 reviews)
4.4
4.4
User Avatar
Hi, PHP, WordPress You may review my profile for previous project and review rating as well. https://www.freelancer.com/u/Rinkup0 Please send me message on chat. So we both can discuss on this. Regards, Rinku P.
€30 EUR in 1 day
5.0 (4 reviews)
2.2
2.2

About the client

Flag of DENMARK
Nyrup, Denmark
5.0
29
Payment method verified
Member since Aug 18, 2016

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.