Customizing WooCommerce order emails

You’ve lovingly setup your first WooCommerce shop: picked out that perfect theme (maybe a recommended one), polished your product page content to an irresistible shine, tested your frictionless checkout, and… received a nice enough but totally generic order email that in no way matches the look, the style of your shop. This generic email doesn’t represent the impression you want to leave your customer with!

A common question from new shop owners is: how exactly do I customize the default WooCommerce order emails to either match my shop’s look and feel, or how do I add some additional content to assist customers with their order? While creating HTML emails is admittedly a specialty with a lot of complexities involved, WooCommerce offers some options that will allow the most novice to perform some basic tweaks, and you can use Jilt’s transactional email feature to make customizations even easier. If you’re comfortable with HTML, CSS, and even some PHP/WordPress development, there’s no limit to the customizations you can create.

Customer emails

“Out of the box” WooCommerce includes 9 transactional emails, 6 of which are sent to the customer and related to their order, so these are the ones we’ll be concerning ourselves with (though any techniques can certainly apply to the other types):

  • On-hold – sent to customers containing order details after an order is placed on-hold.
  • Processing order – sent to the customer after payment and contains the order details.
  • Completed order – sent to the customer when the order is marked complete, and usually indicates that the order has been shipped.
  • Refunded – sent to customers when their orders are refunded.
  • Customer invoice (sent manually) – sent to the customer for an order which requires payment.
  • Customer note – sent to the customer when a customer note is added from the edit order admin.

In addition to the standard email types, you can add completely new and custom emails, though this is considered an advanced topic.

WooCommerce global email options

The standard WooCommerce email looks something like this:

WooCommerce default order email

The WooCommerce admin allows some basic customization of this default email layout, with options found by logging into your WordPress Admin and going to WooCommerce > Emails > Email Options. Some of options include:

  • Set the “From” name/address that the customer sees
  • Add a header image
  • Change the email footer text
  • Choose different base, background, and body text colors

Keeping in mind that these configuration options will apply to all emails, and in just a few minutes we can start creating a custom branded look by setting a header image, custom footer text, and a new “base” color (yellow):

wc-customizing-order-emails-custom-email-1

Looking pretty good! If you’re following along closely you may notice that WooCommerce has detected that a “light” base color was used (the yellow) and automatically changed the title text color to black to provide an appropriate level of contrast. Cool! Unfortunately, the same was not done with the footer text, so this is something we’ll clean up later.

WooCommerce email specific options

Each email type offers its own set of customization options. These can be found by going to WooCommerce > Settings > Emails > Processing order (for the processing order type, of course). Here you can further tweak the content for this particular email type, changing for instance:

  • Whether the email is even sent at all (enabled/disabled)
  • The email subject
  • Email heading (defaults to “Thank you for your order”)
  • Whether the email is sent as HTML or plain text (defaults to HTML)

Here we set a custom email heading “Thanks From Los Pollos”:

A custom email heading
A custom email heading

Overriding email templates

A more powerful (and advanced) way to customize order emails is to override an email template file. WooCommerce uses a convenient templating system that allows you to customize parts of your site (or emails) by copying the relevant template file into your theme, and modifying the code there. Each of the email types has a template file for its content (ie woocommerce/templates/emails/customer-process-order.php) along with a number of shared templates that are used for all emails types (ie woocommerce/templates/emails/email-styles.php). It is this latter which we will override to fix that hard-to-read footer text from before.

  • First you make sure that the following directories exist in your WordPress install: wp-content/themes/your-theme/woocommerce/emails/
  • Next, copy the file found at wp-content/plugins/woocommerce/templates/emails/email-styles.php into your theme at: your-theme/woocommerce/emails/.
  • Finally edit your-theme/woocommerce/emails/email-styles.php to change the footer text to black (only the relevant part of the template file code is shown, for brevity):
...
$credit = "
    border:0;
    color: black;
    font-family: Arial;
    font-size:12px;
    line-height:125%;
    text-align:center;
";
...

This gives us a much more readable footer:

wc-customizing-order-emails-customer-email-3

Conditional customization with actions & filters

The final, and most powerful/advanced way to customize an email is to make use of the actions / filters provided by WooCommerce with some custom code. While this does require some comfort with simple PHP and the WordPress Plugin API, the benefit is that it’s more upgrade-friendly, as the original WooCommerce templates are still used: we’re just injecting/modifying some of the content. Makes sense? Great!

For this example we’ll add some helpful payment instructions to the email, based on the checkout payment type used. To try this out, add the following to where you keep custom code:

// Adds instructions for order emails
function add_order_email_instructions( $order, $sent_to_admin ) {
 
  if ( ! $sent_to_admin ) {

    if ( 'cod' == $order->payment_method ) {
      // cash on delivery method
      echo '<p><strong>Instructions:</strong> Full payment is due immediately upon delivery. <em>Cash only, no exceptions</em>.</p>';
    } else {
      // other methods (ie credit card)
      echo '<p><strong>Instructions:</strong> Please look for "Madrigal Electromotive GmbH" on your next credit card statement.</p>';
    }
  }
}
add_action( 'woocommerce_email_before_order_table', 'add_order_email_instructions', 10, 2 );

When checking out using the “Cash on Delivery” method, the email received by the customer will include the helpful order instructions indicated below:

WooCommerce customized email text
Custom payment instructions

Other methods will include the “Please look for…” instructions instead.

Plugin or payment gateway options

There are a few plugins or payment gateways that actually allow you to customize portions of the order emails. For instance, the built-in bank/wire transfer payment method allows you to configure instructions (containing your wire transfer into, etc) right from the WooCommerce > Settings > Checkout > BACS admin.

Plugins for customizing emails may even let you take changes further. For example, you can use Jilt to customize WooCommerce emails for your orders, sending them through Jilt’s service instead of using the default emails for your site. Here’s an example of an email you can send once an order is completed:

Jilt custom email

Even better, you can get started with Jilt for free, and use it to recover abandoned carts as well.

In closing

In this article we covered five techniques available for customizing WooCommerce order emails, ranging from trivial admin configuration, to advanced action/filter usage. We took the clean but undistinguished default order processing email, and styled it to match our imaginary shop. If you found this material useful and put any of the methods described above into practice, or have one of your own, please let us know with a comment below!

Use Jilt to send WooCommerce order emails

Perhaps the easiest option is to use Jilt for sending WooCommerce post-purchase emails. As noted above, Jilt is an eCommerce email marketing platform built for the needs of WooCommerce stores.

Get set up in minutes and send rich, automated emails based on your customer and order data. Use personalization and segmentation to target the right customers, at the right times, and boost your store’s revenue!

Or learn more about how Jilt can power your eCommerce email marketing.

Justin Stern
Justin is our co-founder and CTO. He drives technical direction for our Jilt app and all integration plugins or apps, and can often be found helping with technical questions about Jilt.

100 Comments

  1. HI!
    Nice tutorial, thanks for that.

    Maybe you could help me on something: I would like to receive with the new order e-mail (the one the admin receives) also a description of the product, instead of only it’s name.

    Any clues?

    Thanks!

    1. Hey there, the easiest way to do this would be to override the email order items template: https://github.com/woothemes/woocommerce/blob/master/templates/emails/email-order-items.php (tutorial on this: http://www.skyverge.com/blog/how-to-override-woocommerce-template-files/) and add in the info where you’d like. However, this will also include your new content in customer emails.

      For example, you could add the short description after the product name:

      // Short description
      echo $_product->get_post_data()->post_excerpt;
      
  2. Hey Justin, I’m very grateful for you post.

    I was wondering as I’m searching all over google and can’t find the answer. How on earth do you remove the price field from the customer email templates? I’ve tried removing the field and it didn’t’ work. I’ve been able to add other customizations just fine on my own like a timestamp, but having such problems with this price column. I found I’m not the only one who struggles with this problem and has had no luck fixing it.

  3. Hi Justin,

    Awesome post. Thank you for the tips. I’ve got a question maybe you can also help me with. I’m trying to remove and modify text that appears in the order breakdown. Specifically, I’d like to change the wording when a customer uses a coupon. Currently it says “Cart Discount: $XX.XX”. I’d like to change the “Cart Discount” wording to something else (“Coupon Applied”, for example), but I can’t for the life of me find the file / line that I need to edit! Any ideas on how to do this?
    Thank you!

  4. Hello!

    Thanks for this nice article!

    I’d like to center the header text and also change the text content of all the emails notifications.

    Can you please help me?

  5. Hi Justin, thank you for posting this awesome article! I am excited to try some of your tips. I was wondering if you might know how I could create a new email template to be sent out to customers who purchased a product from a certain product category. I would probably duplicate one of the existing email templates such as the completed order template, but I don’t know which line to change so it will get sent out to a customer who has a completed order within a specific product category. For us, it is the “waiting list” category.

    1. Hey there, I’d recommend checking out this tutorial and reading through, as it provides a good overview of how to set up an email: http://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/. Instead of triggering new emails based on shipping method, you could loop through the order line items and check for product category, then tweak the rest of the setup to reflect your email type. If this isn’t something you’re familiar with, you could get someone from Codeable or Elto to customize it in less than an hour.

  6. Thanks for your great article!!!
    Maybe you can help me with another one: I would like to receive with the admin-mail the payment method.
    Do you know how this works?
    Thanks!

  7. Hi There,

    thanks for all the tips. I am trying to find a way to change the TEXT of the email that is sent by wc. For example when I confirm the order it says: “your oder is completed”. I would like it to to say: “your order has been shipped”. Does anyone know where to find an answer on that?

    Thanks

  8. Hi there, thank you for the article.

    Is there a way of deleting the Price from the order email that is sent to the customer. My client does not want to show any monetary value on the email.

    Thank you

    1. Hey Brian, you can certainly remove the price from the order emails, by overriding the WooCommerce template files woocommerce/templates/emails/email-order-items.php, woocommerce/templates/emails/customer-process-order.php, and woocommerce/templates/emails/customer-completed-order.php and removing the portions that display the item subtotal $order->get_formatted_line_subtotal( $item ) and totals in the order item table footers $order->get_order_item_totals(). Do this by copying the files to your-theme/woocommerce/emails/ and making the edits. Hope this helps!

  9. Hey Justin

    Thank you for your reply….When I applied the changes as you suggested and then went to make an order the checkout page seems to freeze, it just has a spinning icon and does not do anything else.

    The process in which I made your suggested changes was:- Woocommerce – Settings – Emails – New Order option – view template – deleted the line as you suggested – Save changes.

    Is there something I am doing wrong???

    Thanks

    Brian

    1. Hey Brian, well first off the “New Order” is actually the admin email, so you’ll want to be working with the “Processing Order” and “Completed Order” ones which are sent to the customer. I don’t believe you can edit those templates from the “view template” area; did you use the “copy file to theme” option and edit there? Regardless, any changes to those templates are unlikely to freeze the checkout page, though you could reverse the change you made and place another test order to verify that.

  10. I used the “copy file to them” option but I cannot find the file to edit within the theme. Should it be in the them’s editor that I do this. I am really stuck now!!! Any help would be greatly appreciated.

    Thank You
    Brian

  11. Hi Beka

    Thanks for getting back to me and thanks for the tutorials. I had uploaded woocommerce to my site as a plugin so I am assuming that is why the themw editor isn’t showing the files. Do I have to de-activate woocommerce plugin or can I just ftp the relevant files??

    Thanks again for your help

    Regards

    Brian

    1. Hey Brian, you’ll actually want to edit the files that have been copied to your theme now instead. Via FTP, you’ll go through these folders: your theme > woocommerce > emails and the template files will now be inside this folder. This way, they won’t be overridden if you upgrade WooCommerce. For example, I’d locate the files in twentytwelve-child > woocommerce > emails on my test site. If you haven’t copied over the templates already, you can just put the edited template files here.

  12. Hey Beka

    Thanks for getting back again…Do I still need to FTP the Files to the theme. When I check the Theme Editor there is no mention of woocommerce anywhere!! I uploaded woocommerce to the site as a plugin. Sorry for my ignorance in relation to this, I’m just not too sure what way to do this.

    Again, thank you for all the help and guidance

    Regards
    Brian

    1. Hey Brian, correct, WooCommerce will be under plugins. However, if you create a woocommerce folder in your theme, WooCommerce will check for this to let you override templates, and will use the template files there instead of its own. That’s why we’ll be putting the override in the theme instead with a woocommerce folder, then an emails folder inside of it. This tutorial has a good overview :) .

  13. Thank you for your great tutorial!

    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…

  14. Hi there. First of all, thank you so much for the article.

    I’m wondering if it’s possible to have a conditional statement for each product. I’ve been trying to figure this out for days now.

    For example:

    If the person purchases product A, the email will say “Instruction: Go to LINK A”
    If the person purchases product B, the email will say “Instruction: Go to LINK B”

    I’d appreciate the help.

    Thank you,
    Adrian

  15. Hi! Great Post!
    I really need your help!

    Is there any possibility to hide a specific variation on email notification?
    I mean: I use as variations such as sizes, colors and I want them, but I also use a variation for warranties that I don’t want to see on the emails.

    Please, I’m looking all over the internet but I Can’t find anything!
    Thank you.

    1. Hey Mattia, anything is possible with custom code :) . However, this isn’t exactly a straight forward change – this filter would be the place to start, but you’d have to hook into it, determine whether you’re actually in an email or not (which is probably the toughest part), then make your changes to remove these variation ids. If this isn’t something you’re familiar with, I typically recommend Elto or Codeable for these sorts of jobs.

  16. Hi!
    I was checking your post and i’m not able to find the customisation i’m looking for, maybe you guys could give me a hand.
    I want to delete the header where it repeats the subject i attach photo: http://s18.postimg.org/xuycvekeh/headerwoomail.png
    I just want to leave my custom header image that i uploaded and delete this horrible header that it is only repeating the e-mail subject…

    And also, will it be possible to delay lets say 5 minutes the “processing order” mail?

    Thanks so much for your help! ;)

    1. Hey Carl, it’s not possible to remove that section completely since other parts of the template are added when it’s added. However, you can change the text for it in the email settings for each email. There’s no easy way to delay the emails I’m afraid.

      1. Hi Beka,

        thanks for your quick answer :)
        How can i change the text size of that part to make it smaller (i think is horrible an useless to repeat the subject in such a big font…) ?
        I wanna change it for ALL templates(complete, processing order,…), will i need to go 1 by one to do this?

        The delay thing it is because i have setup a second emails with other details through “Follow-up emails plugin” and this email needs to get before the other but it is always getting later :( any advice?

        Thanks again for your time and your help .

        1. Well you’d have to override the email template as described here to change anything about the font, so if you’re doing that already then you may as well delete the “Header” portion instead – Line 94-102 (you try to avoid overriding them as possible in case templates change in the future). This will apply to all emails. You’d want to override this template within your theme.

          The delay thing would be possible with custom code, but definitely fairly challenging. My advice would be to hire someone to do it for you :) .

  17. Hi ,

    Thanks for the awesome post.

    I have a question to ask. Is it possible to display certain text in email based on the category of the product purchased ? If so, How can I do that.

    Thanks

    1. Hey dinesh, this is certainly possible! It takes some custom coding though, so I’m going to assume a certain familiarity with PHP/WordPress development in order to keep the answer reasonably brief. First you want to either override the template file for the email you want to alter, or view the template file and identify an action hook to use if you can just add the content. Either way, from the overridden template, or from the action call, to check whether a product has the category ‘clothing’ you’d use a check like this: if ( has_term('clothing', 'product_cat', $product->id) ) { // display your content here. Hope this helps!

  18. Hi Justin! Do you know how we’d go about emailing order notifications of placed orders to more than one email address at a time? For example, a customer of ours wants a copy of their order sent to them and also to someone in the billing department. They don’t have a group email address for us to send to.

    Is there a plug in to do this? Something that doesn’t get overwritten every time WooCommerce updates?

    1. Hey Jonathan, there’s nothing “off the shelf” that I’m aware of, though it would be fairly easy to put together with a little custom coding. You just need to find the id of the email you want to send to multiple recipients, and then add the other email addresses when appropriate (by original order recipient email, customer id, whatever). I’ve put together a small sample code snippet to hopefully get you started: https://gist.github.com/justinstern/1003d98afd109565b610

  19. We have launched a plugin called Email Control for WooCommerce (on CodeCanyon) that does what some of you are discussing in this thread – it allows you to customize the styling, colors, logo, and what the text says in the emails sent from your WooCommerce store, using the familiar WordPress Customizer interface. We created the plugin for our store as we needed more control over what the text in our emails said and wanted their design to look more professional and unique. We think the plugin could be a solution for some of you here.

  20. Hey guys, Fantastic tutes.. Learning a lot. Have 2 things I need help on. First: Need to add Brand Name to the Product Name in my Invoice emails. Brand Name is a separate field in my site (i haven’t built it) How do i hook this in to the invoices?

    Second, How can i add Order Date next to Order Number.? I have tried to use the same line of code that pulls the Order Number and just changing the get_Order_Number to get_Order_Date

    Which is the same way the Order Number is pulled, but it returns as a Fatal Error..

    Any help appreciated! Thanks..

    1. Hey David, this would be a bit more complicated / require a bit more code, but you could probably do so by retrieving the items in the order, looping through the order items, and doing a check to see if the category is present for any of the items.

  21. Nice article for customizations, but how does one “add some additional content to assist customers with their order? ”

    I just need to add some text to the outgoing emails. Something that should be really really easy.

    WooC provides a field for a custom footer why don’t they just provide a field for a custom message?

    Thank you.

  22. Widget / $50 / 2 / $100
    This might be the simplest thing in the world… Over in the Advanced WooCommerce Facebook group (https://www.facebook.com/groups/advanced.woocommerce/) a guy was asking how he could customize the emails that HE receives so that they contain all the information he needs w/out having to go back to his dashboard. In other words, he can’t be running back and forth between emails and dashboards. He just simply needs to get the pertinent information in an email. Got it? Ok, so we open up the admin email https://gist.github.com/BurlesonBrad/8eb1dbf52fe5c8df1eef#file-wooadminemail-L29 Now, shimmy on down to line 29. See the word ‘STEVE’? What he’s needing is this https://bradgriffin.me/steve-email.jpg

    So, what can we tell him to do to get the original price of the item into his admin email? Thanks! -Brad He just sent a message that said “the pdf invoicer shows it perfectly” along with this screenshot https://bradgriffin.me/steve-email2.jpg

  23. Thanks Beka. I’m actually looking for the actual code to add :-) (not just ‘where’ to look)

    Check out the comment again, and you’ll see a few gists. (I’m guessing that I should have manually linked all of them in the comment above ~ sorry!) You’ll see that we already have the ‘where-to-look’ part. What he’s needing is the actual variable / string / or field that will output the original price of the item.

    Any idea what that ‘variable / string / field’ would be?

  24. Hi,

    thanks for artile. I use topic Conditional Customization with Actions/Filters. Problem is that my language have chars like š, á, č, ť etc. and this chars are missing in email. do you have some solution?

    Marek

  25. Hi, I read your posts because they seek a solution for the client. Very surprised that the Woocommerce fail to set the information that have come up email after the goods ordered.
    Specifically, this is a shop with wine (my first shop: o) – I need for each ordered item also add marking wine producers, not just the name of the variety:
    Cabernet Sauvignon – Mrva & Stanko
    Cabernet Sauvignon – Vinanza

    Nowhere have I found ways to do it. I label wine producers for products defined under category of product.

  26. Hi Justin,

    On my webshop, an option is to pick up the goods by themselves at our warehouse. When a visitor has chosen this option, I want to add a line with the address and openings hours of our warehouse.

    What code can I use if I want to add a line when the visitor has chosen a certain shipping method?

  27. Hi
    thanks so much – exactly what I was looking for to finalize our new store for our business services, moving to WooCommerce. Needed to have two messages to client about the credit card billing and also a reminder as to URL to go to in order to submit porject.

    One question:
    in your example for functions.php will changing the method ‘cod’ to ‘echeck’ work ? We want to add note about check taking 2-4 days to clear and not have a COD note.

    e.g.

        if ( 'echeck' == $order->payment_method ) {
          // echeck method
          echo 'Instructions: Please allow 2-4 working days for echeck to clear before services can be provided. Thank you..';
        } else {
          // other methods (ie credit card) ...
    (etc)
    
  28. Hi, please i’m tryng to change the object of email in new order in:
    New reservation for – {item_name} – of {order_date}
    where {item_name} is the product name.
    I have tried {item_name} but i’m not shure it exist!
    Any help about?
    thanks

  29. I have a client (who is the admin) who does NOT want email notifications every time a user resets a password, creates a new account, etc. How do I prevent email notifications like this?

    I guess I’m unclear when the “enable/disable” email notification box is checked, who is it sending to? The customer or the administrator? We obviously want the customer to get emailed the information they need, the admin just doesn’t need to be notified when someone looses a password or creates a new account.

    If it is not the administrator, how do I stop email notifications getting sent?

  30. Hello, thanks for your post.
    Im talking from Brasil, and here we use a plugin to get payments with credit card with CIELO. Im found your post because im looking a way to get a name of the credit card sending with the email order. Im trying your suggest, but no lucky, or maybe not to much knowledge about it! :-(
    So, any help to how get the name of the credit card sending in the email order?
    Sorry for my bad english…

  31. Thanks so much for the e-mail customization tips. This is one thing that every web developer I have talked to knew nothing about. I wonder why WordPress makes it so difficult to customize? I mean, they allow for customization of almost everything else without the need to actually alter the code. Do you know if there is a plugin that can do this? Just looking for an easier option.

    Thanks!

  32. Hi,
    could you let me know how to only have the extra info be displayed in the customer’s processing-order. email, not any other emails and not the admin email?
    Thanks!

  33. Hi Beka,
    thank you but this does not work because I only need the text when Paypal is chosen as the payment method. I am using a plugin that is adding a “Pay now”-button that is linking to Paypal in that email, and I want to add some text like “If you have not paid yet, please use the link below”. I know the plugin is using this hook

    add_action( ‘woocommerce_email_before_order_table’, array( $this, ’email_pay_now_button’ ), 0, 1 );

    but I am very new to this and don’t know how to add the text above the link.

  34. I have looked everywhere but cannotfinda solution to how to also send the cancelled-order email to the customer and not only to the admin…could you help me with this? Thank you so much.

  35. THANK YOU!! This is such a helpful tutorial! I am wondering for the part where you add a custom function to echo some html… I’d like to do something like this. Probably will add a bit more text. But I’m wondering, is there a way to edit/delete the specification depending on payment method? I just want to add instructions for next steps that I want to send to every purchase processing order. If you have any advice, I’d greatly appreciate it!

  36. Hello for this helpfull tutorial. I am wondering if there is a way to receive a copy of the customer’s invoice or an email to see that a customer has bought a product.
    Because right know, the only way to see if someone has bought a product, is going to Woocommerce -> Orders. But I would like to receive an email with this information.
    Thank you

  37. I’m using woocommerce 2.4.12 and I’ve entered the text I’ve wante dfor the email footer but when it sends an email the text from teh footer is not there. Icopied the email files over to the customizing folders as described but they still don’t send out the custom footers text I need. Any help would be appreciated.
    Thanks

    1. Sure, there are definitely enough hooks to add further details to emails. The order details template is probably the best place to get started, as these hooks will let you add information right before or right after the order information, and they pass the $order object to the hooks so you can get order and product information for your custom code.

      1. Thank you for your reply. But i don’t know about more information about code :(. Can you help me about this? I just want to add product details in order mail.

  38. Hi! Thanks for this. It works well on first test. I’m using the function.php sample mentioned but this adds the conditional text to both the processing and completed email. I’d like to enter similar code in the template files directly for more customisation but I’m not sure how to alter the sample if it isn’t going in functions.php. Would I simply leave out the add_action & function lines? ie; only use:

    if ( ‘cod’ == $order->payment_method ) {
    // cash on delivery method
    echo ‘Instructions: Full payment is due immediately upon delivery: cash only, no exceptions.’;
    } else {
    // other methods (ie credit card)
    echo ‘Instructions: Please look for “Madrigal Electromotive GmbH” on your next credit card statement.’;
    }
    }

    Thanks again for your help!

    1. yep, if you’re going right into the template you shouldn’t need those bits since you’re not hooking into the template. Always test on a staging / local site first though!

      1. Thanks Beka. Works great! One more quick one. How would I go about setting a similar conditional for the quantity? I have a message to send to users how purchase more than one of any item (same item. not two seperate items). Something like:
        if ( 1 < $order->qty ) {
        I was looking for the quantity or similar tables but can’t find anything. Cheers!

  39. Hi! I’m trying to do something similar, but instead of COD, I’d like there to be a specific instructions when a customer chooses “Local Pickup” for their shipping method.

    I tried this but it didn’t work:

    function add_order_email_instructions( $order, $sent_to_admin ) {
      if ( ! $sent_to_admin ) {
    
        if ( 'local_pickup' == $order->shipping_method ) {
          // Local Pickup
          echo '<p><strong>Instructions:</strong> These are the local pickup instructions.</p>';
        } else {
          // other methods (ie table rates)
          echo '<p><strong>These are the instructions for everything else</p>';
        }
      }
    }
    1. There’s no shipping_method class member for the order abstract like that since there can be multiple methods per order (whereas there’s only one payment method per order). You’d need more additional code to get the array of shipping methods, then check to see if the method you want is in that array to add your notices.

      1. Okay, thanks! I’m a newbie, so I don’t know how exactly to add that code, but I will try to figure it out :)

  40. Hi

    I would like to attach two pdf files to the new order email for administrative purposes. Each pdf file is associated with a component product and stored as product custom fields. I have a function which picks up the relevant file paths depending on which composite product (and therefore the component products) have been ordered. I have the full pathnames in an array but cannot work out how to get the new order template to actually physically attach the files. Do I have to explicitly run the action in the template or should it happen automatically as the filter is set to work on ‘new_order’ emails.

  41. Hi
    thx in advance.
    Now i have down email the notice Customer detail. email.
    i l also put the Billing details bcz my developer has delete the Billng details on page check out so i dont see it and also in invoice with many plugns i tested.
    Can you give an davice for my developer?
    Thx .
    BR

  42. Hi! What a useful and helpful tutorial!
    I was hoping to find some code or a tutorial: I would like the “new order” emails sent to a certain email address if the customer has ordered one specific category.
    Do you have any suggestions how I might go about this?
    Thank you in advance!

    1. Hey petradr, there are filters in place that would let you add recipients to the email conditionally, but I don’t have any sample code around doing so for product categories. This tutorial is a starting point, and you or your developer could customize it further to add the category check.

  43. Nice article!
    But I find it a little bit difficult here,
    maybe the same problem like Juan does.

    When customer put an order to my site, Woocommerce sent an email containing the templates from customer-processing-order.php. After I change order status from “pending” to “processing”, Woocommerce sent an email to customer again, also using the template from customer-processing-order.php.

    I want Woocommerce send different e-mail for “New Order” and when order status changed to “Processing”. I can’t find the templates for the template anywhere.

    Do you have any suggestion or advice for my problem here?
    Many thanks!

  44. Hello,

    Great post. I’ve managed to do everything except for some reason i cannot get the logo to center as you have yours. I’ve tried editing multiple aspects in the email style sheet, headers, etc with no luck. I’m sure it’s probably something simple but i can’t seem to be able to find it.

    If you could please let me know which part needs to be edited to center the logo that would be great.

    Thanks,
    John

  45. I understand very clearly how to override customer-processing-order.php (by placing it in my child theme)

    Is it possible to somehow override WC_Email_Customer_Processing_Order.php in a child theme?

    If so, what would the folder structure look like for this? Where exactly would this file be placed in the child theme?

    Thanks!

    1. Hey Gerald, you can’t override classes the same way. You could extend the class to override some of its methods (if public or protected), but this requires far more familiarity with PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *