Customize, How to set up WooCommerce order email


how-to-email-dat-hang-woocommerce

How to set up WooCommerce order email - Assuming after many days of hard work, you have successfully installed the website on the dedicated WooCommerce web hosting platform


The product page is now connected to the database working perfectly, the checkout process is no problem at all. Each element includes product pages, collections, feedback that reflects your brand's color and style.


Next, you decide to check the product ordering process and then suddenly discover the ordering email is quite bland or too general from the user perspective. Now you will be wondering what is the difficulty of customizing your WooCommerce website.


WooCommerce includes several order statuses that do not match the website flow, but you can still mark custom status orders such as Pending, Processed, Paused, Failed, etc.


Many WooCommerce website owners and administrators have this general query: How do I modify the default WooCommerce notification request to have a brand interface or how to add additional content to help customers place orders order, how to create a custom WooCommerce order status.


While creating impressive HTML emails is truly an accomplishment, WooCommerce offers a few options that even amateurs can create great email.


Email client


how-to-email-dat-hang-woocommerce


Vanilla provides WooCommerce email notifications sent to customers in response to their interactions with the website. Next is the most important email for WooCommerce website customers.


  • New orders: New order email is sent when new orders are received.

  • Order canceled: Canceled order email is sent when the order has been marked as canceled.

  • The order was not successful: Order email not sent when order is being processed or paused is marked as Failed.

  • Order pending: This is an order notification sent to the customer. It contains the line item once placed.

  • Order processing: This is an order notification sent to the customer. It contains line items once paid.

  • The order has been completed: Email for order completion will be sent to customer when the order from them is marked completed. These emails usually indicate that the order has been shipped.

  • Orders are refundable: Email back the order sent to the customer when the order marked refund.

  • Customer bill: Customer invoice email containing order information with payment link.

  • Observant of customs: Email customer notes are sent when you add notes to order.

  • Reset Password: Customer password reset Email is sent when customers reset the password.

  • New account: Customers have new accounts Email sent to customers when customers register through the payment page or account registration page.

In addition to this standard email type, you also get custom email.


Global WooCommerce email option


The standard WooCommerce email looks like this:


how-to-email-dat-hang-woocommerce


WooCommerce administrators agree to basically customize this default email layout. This option is accessed after logging in to WordPress Administrator and then going to WooCommerce> Settings> Email> Email Sender Options. This option includes:


  • Name From / Address (visible to customers)

  • WooCommerce email header image size

  • Change the email footer text

  • Choose different base text, background, basic colors

how-to-email-dat-hang-woocommerce


how-to-email-dat-hang-woocommerce


Remember this option applies to all emails. In just a few minutes, you can conveniently create highly customized emails by resizing WooCommerce email header image, custom footer text, and other primary colors.


how-to-email-dat-hang-woocommerce


You notice that WooCommerce has defined a bright base color that has been used. To compensate, it used shades that match the title. Unfortunately, this logic has not been applied to footer content. This error is easily corrected manually!


Specific options Email WooCommerce


Each type of email has its own set of customization options. This option is accessed via WooCommerce> Settings> Email> Order Processing (This example path focuses on Order email processing), including:


  • Enable / Disable whether email is sent or not

  • Email subject

  • Email subject (Default is Vietnamese Thank you for ordering)

  • Whether email is sent as HTML or plain text (The default option is HTML)

how-to-email-dat-hang-woocommerce


Here, I have set the custom email header as ‘Thank you for your order.’


how-to-email-dat-hang-woocommerce


Override a custom WooCommerce Template


A more effective approach is to modify the default email layout. WooCommerce provides a useful template system that allows you to customize the website / email section by copying the format file into the interface. Each type of email has a template file with content from it (Example: e-commerce / template / email / customer-process-order.php). In addition, there is a sharing template that all types of emails access and use. They are found at WooCommerce / samples / email / email-style.php. In many cases, this is a template the developer overrides changes to the shared aspect of email. The process for handling the footer issues mentioned earlier is:


  1. First, make sure the following directory exists for the WordPress installation process: wp-content / Themes / your-theme / WooCommerce / email.

  2. Next, copy the file found at wp-content / plugins / WooCommerce / samples / email / email-style.php into the website interface at: your-theme / WooCommerce / email /.

  3. Finally, edit the interface / WooCommerce / emails / email - stst.php to change the footer text color to black (for simplicity, only the code sample display is displayed):

how-to-email-dat-hang-woocommerce


This makes the footer much more readable:


how-to-email-dat-hang-woocommerce


See more: How to create a form in wordpress


Custom conditional with Action / Filter


The final, most effective approach to customizing emails is to work with WooCommerce custom code. This obviously requires a high level of PHP expertise. The good news is that the process is simple as the original WooCommerce layout is still in use. This process involves changing the content.


Filter function


  • has_filter ()

  • add_filter ()

  • apply filters ()

  • apply_filters_Vf_array ()

  • current_filter ()

  • remove_filter ()

  • remove_all_filters ()

  • doing_filter ()

Action function


  • has_action ()

  • add_action ()

  • do_action ()

  • do_action_Vf_array ()

  • did_action ()

  • remove_action ()

  • remove_all_ilities ()

  • doing_action ()

Function to activate / deactivate / uninstall


  • register_activation_hook ()

  • register_uninstall_hook ()

  • register_deac activate_hook ()

In this example, I will add some useful payment instructions to your email, based on the type of payment used.


To get started, add the following to the interface.php function:


how-to-email-dat-hang-woocommerce


If the customer chooses not to receive cash at Door-to-door delivery during the transaction, he / she will receive an email with helpful ordering instructions:


how-to-email-dat-hang-woocommerce


Option Plugin / Payment gateway


Some plugins and payment gateways actually agree that you customize the ordering email section. For example, the integrated bank transfer / payment method agrees that you have configured the instructions, inserting bank transfer information. This is done smoothly through WooCommerce> Settings> Payments> BACS.


how-to-email-dat-hang-woocommerce


While it's not common, it's good to know this option is available. This information also helps you in choosing specific plugins for your website.


WooCommerce Email add_ilities Hook


When working with WooCommerce email, the add_ilities hook is often useful. When working with this hook, you will need to use a global variable, the email will contain the email interface. Here is the code:


how-to-email-dat-hang-woocommerce


The hook above is located at the function.php or at the top of the WooCommerce email template. The global $ email variable calls the main WooCommerce email object, when $ order contains the global WooCommerce ordering object.


how-to-email-dat-hang-woocommerce


Custom WooCommerce Email for each product


The following code sends a customized order email template with another product


for example, for product ID 87 you want to display the WooCommerce email notification header OR how to check the WooCommerce email:


how-to-email-dat-hang-woocommerce


Note: Now that you know the whole process of Customizing WooCommerce order emails, now you choose to retain the functionality or create a separate WooCommerce email plugin for WooCommerce email confirmation / notification.


Conclusion


Setting up the WooCommerce website is quite simple, but customizing the default email template can sometimes be difficult. In this tutorial, I discussed how you send WooCommerce hosting emails that are completely customized to fit every aspect of your website activity. I also emphasize how to change the default email template to insert site-specific / email-specific information to provide a better user experience.


Leave your comments below if you want to add to the discussion or ask a question!