WooCommerce send customers and store admins emails when new orders are placed, these emails contains all sorts of info relating to the order, however it is missing a couple of things that can be useful to customers or store admins.
One of the fields that is not present in the WooCommerce order emails are the payment type, some WooCommerce store admins would perhaps want to know this data in emails for decisions on whether to ship items immediately or to hold off for a while for money to clear.
To add the payment type to all WooCommerce emails or just admin email add the following code to your theme’s functions.php file, this is upgrade safe and the changes will stay in place after WooCommerce updates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Place the following code in your theme's functions.php file to add the payment type to all emails | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_emails', 15, 2 ); | |
function wc_add_payment_type_to_emails( $order, $is_admin_email ) { | |
echo '<p><strong>Payment Type:</strong> ' . $order->payment_method_title . '</p>'; | |
} | |
// Place the following code in your theme's functions.php file to add the payment type to admin emails only | |
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_admin_emails', 15, 2 ); | |
function wc_add_payment_type_to_admin_emails( $order, $is_admin_email ) { | |
if ( $is_admin_email ) { | |
echo '<p><strong>Payment Type:</strong> ' . $order->payment_method_title . '</p>'; | |
} | |
} | |
?> |
Oh man, I wish I could have found your site earlier. You offered all sort of things which are must needs for a woocommerce store. Thank you for making and sharing this. You are simply awesome!
Tim, glad you are finding it useful.
Great post. How would I add the delivery method into the emails as well?
Hi John, please see this post on how to do that http://gerhardpotgieter.com/2013/12/05/woocommerce-add-shipping-method-to-emails/
How to add custom fields to admin email?
Hi Alex
This tutorial does not cover carrying over the field to the cart and checkout to include in the order, this is just for display custom fields on the product pages. Having the values cary over to the order will require quite some development work. Perhaps look into the product add-ons extension which enables you to do this http://www.woothemes.com/products/product-add-ons/
Hi, is there a way to get the credit card issuer information e.g, Visa, Mastercard? Thanks for all of the help!
Hi Michael
Unfortunately no, WooCommerce does not store any credit card information as this is considered a security risk. All credit card info is passed directly to the payment gateways where they process it.
Hi Gerhard
This is very helpful. Thank you
My client wants to have the payment information included both in the emails for clients and for the admin.
Should I remove the text ( // Place the following code in your theme’s functions.php file to add the payment type to all emails) from the code?
<?php
// Place the following code in your theme's functions.php file to add the payment type to all emails
add_action( 'woocommerce_email_after_order_table', 'wc_add_payment_type_to_emails', 15, 2 );
function wc_add_payment_type_to_emails( $order, $is_admin_email ) {
echo 'Payment Type: ‘ . $order->payment_method_title . ”;
}
?>
Thank you for help.
Hi Martyna
To add it to all emails you can just use the first code snippet in the file, so just as you copied there, you can leave in the // part as that is just a comment.
Thanks dude! Have subscribed to your newsletter. 🙂
This is great, just what I needed, thank you very much!
Hi. Thanks for this.
Do we have to have copied the “admin-new-order.php” to our theme for this to work?
As I see this message at the bottom of the woocommerce > settings > emails > new order email page ….
“To override and edit this email template copy woocommerce/templates/emails/admin-new-order.php to your theme folder: yourtheme/woocommerce/emails/admin-new-order.php.”
Hi Kat
No, no need to do that, this uses a hook and not a template override.
Thanks – that’s one less job to have to figure out 🙂
Hi,
Thanks for the useful post!
I was wondering if you know how to have woocommerce send a different email to the customer based on which payment type they have selected?
For example, if customer selects pay via credit card, then email template #1 would be sent to them upon checkout completion. If customer selects pay via paypal, then email template #2 would be sent to them. Etc…
Hi Sean
I do know, however that will require quite some custom development to be done in order to achieve that.
Hi.
Thanks for the code, but it’s not working for me after putting the first code into the functions.php. Still the order emails comes without payment method. Any tips?
Hi Gerhard, thanks for the above! Any idea how I would get the category of the product to show in the admin email table? Thanks
Hello,
How can i just ad some ‘custom product add ons’ to the confirmation email ?
I have made a custom product add on with a text field, i want to put the text into the admin email.
Thank you!
Thanks, exactly what I was looking for.
Best: Rolf
Finally!! Thank you so much! I’ve been wasting hours for looking something like this.
Thanks Gerhard
Works perfectly. I used admin only code as the client invoice email already has this info. Not sure if it is just the Product Add-ons plugin that facilitates this in the client email or not.
I just added this to my plugin 🙂
Thank you, great! It works! But disappears when theme updates …
Hi,
Thank you for the tutorial. Helped me a lot 🙂 Is there a way to display all parent categories of a product in the woocommerce checkout email? Would appreciate any help.
Thank you again.
Hello G,
First of all very usefull and add value Woocommerce information here, my complements.
Any change you could explain how to add also the order status to the admin emails?
*pff hard night, sorry for the typos:
*My compliments.. and.. Any chance how to explain adding the order status..
🙂
0 Pingbacks
Categories
Top Posts & Pages
Instagram
No Instagram images were found.
Get Email Notifications