Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active October 20, 2022 11:25
Show Gist options
  • Save bekarice/50900986dc58f00ec765 to your computer and use it in GitHub Desktop.
Save bekarice/50900986dc58f00ec765 to your computer and use it in GitHub Desktop.
Add customer name to WooCommerce Admin New Order Email subject
<?php // only copy this line if needed!
/**
* Adds customer first and last name to admin new order email subject.
*
* @param string $subject email subject
* @param \WC_Order $order the order object for the email
* @return string updated subject
*/
function skyverge_add_customer_to_email_subject( $subject, $order ) {
$subject .= ' from ' . $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
return $subject;
}
add_filter( 'woocommerce_email_subject_new_order', 'skyverge_add_customer_to_email_subject', 10, 2 );
@td8000
Copy link

td8000 commented Oct 20, 2022

hello, same question would be important for me. the code works fine, just the product name must be added to the subject.
How can that be done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment