Skip to content

Instantly share code, notes, and snippets.

@bentasm1
Created September 3, 2015 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bentasm1/1ab3ba702683a733daa4 to your computer and use it in GitHub Desktop.
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
/* 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