Created
September 3, 2015 18:10
-
-
Save bentasm1/1ab3ba702683a733daa4 to your computer and use it in GitHub Desktop.
WC Vendors - Change Product Enquiry to send to vendor and another email address
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
/* WC Vendors - Set Product Enquiry to send to two emails. First being the vendor, second being an email address you set in the code below */ | |
remove_filter( 'product_enquiry_send_to', array( 'WCV_Vendor_Shop', 'product_enquiry_compatibility' ), 10, 2 ); // Removes the WC Vendors Filter | |
add_filter( 'product_enquiry_send_to', 'product_enquiry_send_to_custom', 10, 2 ); // Adds your new filter and specifies the function name to call | |
function product_enquiry_send_to_custom( $send_to, $product_id ) { | |
$author_id = get_post( $product_id )->post_author; | |
if ( WCV_Vendors::is_vendor( $author_id ) ) { | |
$send_to = get_userdata( $author_id )->user_email . ', SOMEONE@ELSE.COM'; // Change the email here. Leave the comma and space because that is how we're sending two email addresses. | |
} | |
return $send_to; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment