WooCommerce customizers: the Visual Hook Guide is back!
Here’s a visual HTML hook guide for the WooCommerce Emails. This visual guide belongs to my “Visual Hook Guide Series“, that I’ve put together so that you can find WooCommerce hooks quickly and easily by seeing their actual locations.
Let me know in the comments if this resource is helpful and how. Enjoy!
WooCommerce Email Hooks
|
WooCommerce Email Default add_actions
// --------------------------------------
// These are actions you can unhook/remove!
// You must use $object inside remove_action
// Where $object = WC()->mailer();
// --------------------------------------
// Email Header, Footer and content hooks
add_action( 'woocommerce_email_header', array( $object, 'email_header' ) );
add_action( 'woocommerce_email_footer', array( $object, 'email_footer' ) );
add_action( 'woocommerce_email_order_details', array( $object, 'order_details' ), 10, 4 );
add_action( 'woocommerce_email_order_details', array( $object, 'order_schema_markup' ), 20, 4 );
add_action( 'woocommerce_email_order_meta', array( $object, 'order_meta' ), 10, 3 );
add_action( 'woocommerce_email_customer_details', array( $object, 'customer_details' ), 10, 3 );
add_action( 'woocommerce_email_customer_details', array( $object, 'email_addresses' ), 20, 3 );
add_action( 'woocommerce_email_order_details', array( $this, 'generate_order_data' ), 20, 3 );
add_action( 'woocommerce_email_order_details', array( $this, 'output_email_structured_data' ), 30, 3 );
// New Order email only
add_action( 'woocommerce_email_footer', array( $this, 'mobile_messaging' ), 9 );
// Customer emails if BACS / COD / cheque payment
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
Very good Site. Just a godsend for the WP admin! Please tell me, is it possible to somehow display the client’s first and last name in the subject of a letter about a new order?
https://www.businessbloomer.com/woocommerce-add-billing-first_name-to-email-receipt/
I have a script that adds a profileID to a specific product when that product is ordered. The script works as expected except for one thing. When the new order email is generated and sent to the store manager the profileID is not in the order details. That profileID appears in every other email and in the order details in the admin area. I am sure it is because the profileID is being added after the new order email is generated, but am not sure what hook to use to make it add after payment and before emails are generated. Any suggestion of what hook to use for this.
Which hook do you use now to attach the custom field value?
Hello, Rodolfo.
Please clarify what exactly you want to say with: “You must pass $object to the function”.
Can you give us an example of “$object” for the sake of understanding?
Screenshot: https://www.screencast.com/t/yJ6NDDtgTAsM
Thank you!
You’re right, not clear at all.
In order to remove e.g.
you need to use (untested):
HI Rodolfo,
I love your site it is a treasure trove of resources.
I am wondering if it’s possible to add the PRODUCT DESCRIPTION to the CONFIRMATION EMAIL using a snippet.
I am using Oxygen Builder and Kadence Email Customizer on the site.
Thanks for your help
Hi Demetre, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
is it possible to obtain the total number of the quantity of the products and write it under the subtotal heading?
Hello Nicola, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi Rodolfo, thank you very much for such professional and detailed work,
In the case of downloadable products, the emails show the order details and the download in different tables placing the download’s table first, can this order be changed ?
In other words, the order detail can be placed over the download detail table?
I’ve tried to change the email templates, using a child theme don’t worry … both tables are entered with the ‘woocommerce_email_order_details’ hook but they don’t come from the same template and it’s a bit confusing ..
Thank you in advance 🙂
Hello Enson, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hey Rodolfo,
After so many tries, I am finally here to ask you for your help!
Actually, My question and issue is with WooCommerce Email Templates,
In My Order email, When I see my order email in Gmail, It turns any email texts as links, and applying their own style which is blue. That I need to update colors. I have tried many solutions but none of them works for me.
Can you please help me?
Thanks in advance!
Hey Sumit! Try with https://www.businessbloomer.com/woocommerce-add-css-woocommerce-emails/
Happy New Year Rodolfo and thank you for that great overview. I have one more question, however. Is it possible to hide the element with the OrderID and the order date in front of the table? It seems like an element of the
to be. A customer of mine would like to have his own introduction and find that annoying.
Best regards
Arnim
Hi Arnim, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hey Rodolfo, I think this woocommerce_email_order_meta should be woocommerce_email_order_meta_fields. I tried yours but it keeps giving me errors when trying to checkout.
Appreciate all your work!
Thanks for your feedback Stan, no, that should still work. What code did you write?
Hello
how can i add Labels to each address line detail in the new order email sent from woocommerce
for example:
Billing Address:
Country : USA
Street : 5
City: NY
……
Hi Khalid, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Thanks for this helpful article.
You’re welcome!
Hey, You are a lifesaver, you know?
Thank you!
Hello fellow programmers,
I googled almost everywhere but cannot find the solution to my problem… I use Checkout Field Editor for WooCommerce plugin. I created couple new fields there ( pls see the picture here: https://prntscr.com/rzyiia ). I want these fields to display in shipping address box in email. I do not understand how to do this, which hook should I use to accomplish this? Here in this image I show where do they display instead ( https://prntscr.com/rzyn60 )
Please if there any good folks who can help me?
Thanks!
Ask the plugin devs please
On a new order email is there a way of displaying the Unit price rather than the total price for each item? So if someone ordered 5 pumpkins it shows the total price for all 5, what i also want to show it the price per pumpkin.
Hi Patrick, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi Rodolfo!
First of all; thanks for this awesome guide series.
I’m trying to add some attachments (some pdf files that I created) to new order mails . But here’s the problem: I create PDF files when the “woocommerce_thankyou” hook triggered. But I guess the mails are sending before this. So “woocommerce_email_attachments” hook isn’t working for me. What can I do?
Maybe you can use an earlier hook e.g. on order created?
Hello,
I have used your php snippets before with success, so thank your for that. However I can’t find something I am looking for. I would like to hide the e-mail address and phone number on orders in woocommerce for my vendors. So how can i remove this from the orders that are shown in the product vendors dashboard from woocommerce? I hope you can help me out, cause I have searched the internet, but wasn’t able to find anything.
Look forward to hear from you.
Kind regards,
Tessa
Tessa, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi, Rodolfo! Not entirely on topic but related: I’m trying to record in order notes when an order email has been sent. This is for admins so they know when an email went out. I can’t however see any hook linked to order email sending which I can use to trigger an order note being written. Am I missing something obvious or does Woo not offer the ability to hook into order email send action? Many thanks, Edith
Hi Edith, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Your guides are great! I note your graphic uses the business-facing email as a demo, but do the same hooks apply to the customer-facing emails? Also, if so, does that mean inserting text via these hooks will insert it for both kinds of email? Right now, I’m just trying to affect customer-facing (order processing) emails.
Hello Aaron, this should help: https://businessbloomer.com/woocommerce-add-extra-content-order-email/
Hello
Is it possible to remove the woocommerce_email_footer completely? I have tried to remove_action for the email footer but nothing I’ve tried has worked out. Any help would be greatly appreciated.
Thanks
Hello Dylan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
HI Rodolfo,
Thank for the clear explanation videa’s. I’ve managed to add some content to my order processing email.
Only adding when I try to add content in the footer using hook woocommerce_email_footer, it will display the content even under the footer instead of in the footer. What am I doing wrong?
Hi Joren, thanks for your comment. It could be missing HTML/CSS or maybe Gmail in case you’re sending tests to yourself and it’s truncating duplicate content from previous identical emails. Let me know
Thanks for this helpful article.
I would like to know if it is possible to change the text in the email template without overriding the whole file?
Thanks
Hello Khadiga, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Thank you very much for this visual stuff. it helped me to understand it rapidly Bundle of thanks 🙂
Thank you Rohi 🙂
Hello Mr. Melogli
I was hoping you might be able to help me:
The image https://imgur.com/7WtDW8u displays an issue: “Undefined variable: email in /usr/www/mytowqvypx/wp-content/themes/towerlabels/woocommerce/emails/customer-order-status-email.php on line 65”
Does that mean that the issue is limited to $email or every do_action(~); that contains it?
Your assistance is most appreciated.
Thank you and Kind Regards
Luan
Hey Luan 🙂 The issue is with your theme, you need to update it or switch to another one.
Hi Rodolfo!
I want erase the link “View my bookings →” of the email that receive the client.
Just this link.
I don´t know how do it.
Can you help me?
Hello Ulises- thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Hi Rodolfo, Fantastic guide – thank you!
I have a question. Orders with both downloadable and shipped products show these in two distinct tables; are there hooks to only target the ‘downloadable’ items table? I’ve scoured the code but I feel like I’m missing something. Thanks for all your great content!
Hey Lionel, thanks for your message! The only ones I could find are:
Not sure if this helps 🙂
dear Sir.
please help me i want to add product weight at bottom of product title in woo-commerce emails.
Hi there, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Can you guide me how to send cancel emails to customers, and let them know that there email are the cancel with the reason
Hey Abdul, thanks so much for your comment! You can enable cancel order email notifications from the WooCommerce settings 🙂
Hi, if we have to add text we have no option but to edit the template ( of course by copying the template into the child theme ) ? or is there a way to achieve the above with hooks?
Hi Srikanth, thanks so much for your comment! It depends where you need to print it 🙂
I have added som extra content with the use of “woocommerce_order_item_meta_end”
But I see the message on all email templates.
How to only show the content on the “Completed order” template ?
Hey Simon, thanks for your comment! Section #4 of my video tutorial should help you achieve just that: https://businessbloomer.com/customize-emails-woocommerce/. Hope this helps
Hi!
Can I add email for new user notification?
When a new customer sign in even if he did not make an order, I would like to get a notification email.
(the recipient now is only the customer)
Is that possible and how ?
any suggestion will be great 😀
thanks in advanced
Hey Natalia, thanks for your comment! I believe you can add multiple email recipients to the same email, give it a go 🙂
Hi, it is possible to make a hook, where the email that is sent to the customer after making a purchase (customer-on-hold-order.php.) Also reaches an email that I define?
Francisco, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R
Hi Rodolfo is possible hide billing_company field from emails?
Hey Mattia, thanks for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R
Hi,
First I would like to say that you have a very important site.
Thank you for all the tutorials.
Few questions:
———————
How can I:
1. Add the regular price above the price (with strike through)?
2. Add the total discount for the order in woocommerce_email_after_order_table?
Thank you,
Sam
Hey Sam, thanks for your comment! I can’t help I’m afraid as it is custom work, however have you watched my tutorial yet: https://businessbloomer.com/customize-emails-woocommerce/?
Hi Rodolfo
I wanted to add a footer image to my e-mail template. Is this complicated?
Thanks
James
Hey James thanks for your comment! No, it’s not complicated, as long as you understand minimal HTML and PHP. Take a look at this video tutorial, hopefully it can help together with my visual hook guide: businessbloomer.com/customize-emails-woocommerce/
Hi, I have found it before but can’t find it anymore: where do we customize the code? (which file?)
Thanks, Agnes
Hey Agnes, thanks for your comment! You can place your customization in your child theme’s functions.php file – if you need more guidance, please take a look at this video tutorial: https://businessbloomer.com/woocommerce-customization-hangout/. Hope this helps!
Hi Rodolfo, what a great info here in your awesome blog.
I want to ask you if there is any way to hide/delete the prices row in this email
thanks a lot
Thank you so much David!!! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R
I am new to all of this, but with your help I have been able to accomplish quite a few things. I am having a bit trouble of adding the product images to the email notifications. Is there a snippet or code for that function to work?
Hello LaToya, thanks so much for your comment! Yes, this is possible, but unfortunately I don’t have a snippet for that and I cannot provide a complementary solution here on the blog. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Thanks for this, one of the easiest tutorials to follow that I have seen 🙂
Awesome, thanks Stewart!
Hi Rodolfo, i’m looking for a way to put, in the new order email, the product variation description (the one appears here when you choose a box type… (https://www.naranjascostadelsol.es/tienda-de-naranjas-online/naranjas-de-mesa-mandarinas-y-aguacates/).
I spent a lot of hour to look for something valid but …no way…still searching… but now i fond your post here…and it seems i should work on woocommerce_order_item_meta_start… but i have no php skill…so do you have a snippet to do it?
Thank you very much
Angelo
Angelo, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide you with a complementary solution here on the blog. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Wow. That’s exactly what I was looking for! Thank you!
Took me 20 seconds. 😀
Awesome! Great to hear that Kevin 🙂
HI,
Is it possible to use hooks/filters to change the text which says: “Your order has been received and is now being processed. Your order details are shown below for your reference:” which appears at the top of the customer processing email?.
Hey Andy, thanks for your comment! There is no filter to change that string, but I would recommend you try with this: https://businessbloomer.com/translate-single-string-woocommerce-wordpress. Let me know if it works!
That looks great I will have to try it.
I would also ideally like to change the text inside this:
<?php printf( __( 'Thanks for creating an account on %s. Your username is %s‘, ‘woocommerce’ ), esc_html( $blogname ), esc_html( $user_login ) ); ?>
which is sent in the new account email.
I will want to keep the part of the string that dynamically displays the username so the complete new text will look like:
Many thanks for creating an account with us, we’re delighted you’ve chosen to shop with us.
Your username is:
Kindest wishes
Shop Name
But will this part of the string:
%s
copy/translate over to the new string ok and ?
Andy, with the translation snippet I referenced, you can totally translate “Thanks for creating an account on %s. Your username is %s” as a string. Only thing is that you have to maintain the order of the “%s”, so you will need to mention the shop name before the username.
Otherwise, You will need to override the whole WooCommerce template.
Brilliant, thanks!
You’re welcome!
Hey Rodolfo, loved your webinar yesterday, thanks.
I hope you can point me in the right direction as I can’t find the answer to this anywhere on your site but I’m sure you have probably covered it somewhere.
On most customer emails there is a table that is headed:
Product Quantity Price
and contains rows showing Subtotal & Total.
Where/how can I edit the table? I need to change the word Product to Event and if possible remove the Subtotal row as it isn’t relevant or required
Thanks in advance
Hi Rodolfo, just a quick update.
I found I needed to change the email-order-details.php file for the Table Headings (simply changed the text in my child theme file)
As for the SubTotal & Total – I removed a block of code from the bottom of the same file:
Might help somebody!!
Thanks Mark for updating us! I really hope you haven’t edited the plugin core files, but duplicated email-order-details.php into your child theme’s /woocommerce/emails folder 🙂
Also, this might have been done without this duplication I believe (remember, duplicating templates should be done only when strictly necessary).
Cheers and thanks again!
R
Don’t fret – it wasn’t the core file but in the child theme. Thanks for checking.
Ah, awesome Mark 🙂 Glad about that! Thanks for following up.
Hi,
Thanks for this very detailed tutorial / guide.
Is there any way we can add a custom image next to the text where “New customer order” is mentioned?
Thanks.
KoolPal
Good question KoolPal!
You can easily add content above or below, but doing it beside it’s pretty complex as there is no official hook. You might need to override the email-header.php in your child theme (not recommended), or maybe use the filter “woocommerce_mail_content”.
Let me know if you find anything! I hope you can join us for the WooCommerce Emails Customization Class by the way 🙂