Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Last active June 8, 2020 17:24
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mikejolley/1926284 to your computer and use it in GitHub Desktop.
Save mikejolley/1926284 to your computer and use it in GitHub Desktop.
WooCommerce - Change WooCommerce email subject lines
/*
* goes in theme functions.php or a custom plugin
*
* Subject filters:
* woocommerce_email_subject_new_order
* woocommerce_email_subject_customer_processing_order
* woocommerce_email_subject_customer_completed_order
* woocommerce_email_subject_customer_invoice
* woocommerce_email_subject_customer_note
* woocommerce_email_subject_low_stock
* woocommerce_email_subject_no_stock
* woocommerce_email_subject_backorder
* woocommerce_email_subject_customer_new_account
* woocommerce_email_subject_customer_invoice_paid
**/
add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);
function change_admin_email_subject( $subject, $order ) {
global $woocommerce;
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s', $blogname, $order->id, $order->billing_first_name, $order->billing_last_name );
return $subject;
}
@moghwan
Copy link

moghwan commented Oct 22, 2012

hi, i just copy paste it and no result, the main problem to me is the subject is shown like "Commande reçue" instead of "Commande reçue", the letter "ç" does not appear correctly, why ?

@JamesSimpson
Copy link

I take it there is no function for the "on-hold" status?

@alemarengo
Copy link

Isn't there a way out there with which we can make email a little bit more personal?
I'm struggling to find a simple solution in order to include $order->billing_first_name within subject emails. It seems impossible though... :(
For instance, if I wanted to use your snippet to include a translatable billing_first_name text string for _new_order, _processing_order and _completed_order should I use a plugin or can I just tweak this code to do it?

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