Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created August 7, 2014 14:57
Show Gist options
  • Select an option

  • Save corsonr/100f1b1976a43442c58d to your computer and use it in GitHub Desktop.

Select an option

Save corsonr/100f1b1976a43442c58d to your computer and use it in GitHub Desktop.
WooCommerce Product Enquiry: send email to post author
<?php
// Product Enquiry Form: send email to post author instead of Site Admin
add_filter( 'product_enquiry_send_to', 'wc_product_enquiry_to_author', 10, 2 );
function wc_product_enquiry_to_author( $email, $product_id ) {
$post_author_id = get_post_field( 'post_author', $product_id );
$post_author_email = get_the_author_meta( 'user_email', $post_author_id );
return $post_author_email;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment