Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Basilakis/94acdc2a9e544a701abd to your computer and use it in GitHub Desktop.
Save Basilakis/94acdc2a9e544a701abd to your computer and use it in GitHub Desktop.
Add customer name to WooCommerce Admin New Order Email subject
// Adds customer first and last name to admin new order email subject
function skyverge_add_customer_to_email_subject( $subject, $order ) {
$subject = 'New Customer Order - (# ' . $order->get_order_number() . ') 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 );
@Uriel1339
Copy link

Uriel1339 commented Feb 27, 2020

Above is obsolete code, should be updated to this:

// Adds customer first and last name to admin new order email subject
function skyverge_add_customer_to_email_subject( $subject, $order ) {
	$subject = '[store name] New Customer Order - (# ' . $order->get_order_number() . ') 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 );

@Basilakis
Copy link
Author

Basilakis commented Feb 27, 2020

@Uriel1339 A reason that details from a client site are included? :)
I have updated the code, thank you for sharing!!

@Uriel1339
Copy link

Oh sorry lol. Was just copy-pasta because we hardcode site name to minimize WooCommerce calls.

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