Created
January 16, 2015 09:06
-
-
Save woogist/ec240241eb49a69c8dc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_new_booking', 'wooninja_send_pending_confirmation_email', 10, 1 ); | |
function wooninja_send_pending_confirmation_email( $booking_id ) { | |
$what_that = get_wc_booking( $booking_id ); | |
$vendor_id = $what_that->custom_fields["_booking_vendor"]; | |
$vendor_id = intval($vendor_id[0]); | |
$GLOBALS['pending_conf_vendor'] = $vendor_id; | |
add_filter( 'woocommerce_email_recipient_new_booking', 'wc_send_new_booking_multiple_addresses' ); | |
do_action( 'woocommerce_booking_pending-confirmation', $booking_id ); | |
remove_filter( 'woocommerce_email_recipient_new_booking', 'wc_send_new_booking_multiple_addresses' ); | |
} | |
function wc_send_new_booking_multiple_addresses( $recipient ) { | |
global $pending_conf_vendor; | |
$recipient = rtrim( trim( $recipient ), ',' ); | |
$vendors = get_vendor_admins( $pendinf_conf_vendor ); | |
$new_recipients = array(); | |
foreach( $vendors as $vendor ) { | |
$new_recipients[] = $vendor->user_email; | |
} | |
$recipient .= ',' . implode( ',', $new_recipients ); | |
return $recipient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment