Im trying to override the admin email template text "New customer order" to "New order" in function.php, but i can not finde any info on google. Can somebody please give me a hint! :)


The easiest way to override the WooCommerce emails is to copy woocommerce/templates/emails/admin-new-order.php to yourtheme/woocommerce/emails/admin-new-order.php and make any changes in your version of the template. This will ensure that any changes you make do not get lost during any subsequent upgrades.

The text displayed in the subject line of the email is controlled via the GUI and may need changing if you wish to keep the 'New Order' text the same throughout.

However, if you really wanted to go down the route of changing the header text through the functions.php file, you could potentially hook into 'woocommerce_email_header':

function action_woocommerce_email_header( $email_heading ) { 
    // Change the email heading in here.
add_action( 'woocommerce_email_header', 'action_woocommerce_email_header', 10, 1 );

The $email_heading will be a string value containing the full HTML markup of the email header, it will contain the text 'New customer order' so you could do a simple str_replace, searching $email_heading for 'New customer order' and replacing it with 'New order'. For example:

function action_woocommerce_email_header( $email_heading ) { 
    $new_email_heading = str_replace( 'New customer order', 'New order', $email_heading );
    return $new_email_heading;
add_action( 'woocommerce_email_header', 'action_woocommerce_email_header', 10, 1 );

This is only a very crude example as you will need to cater for occurrences where 'New customer order' isn't present, for example. Hopefully it'll get you started along the right tracks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.