Emails play a crucial role as the primary means of communication between a WooCommerce store owner or a WordPress site owner and their customers. To personalize this interaction, WebToffee’s Decorator – WooCommerce Email Customizer Plugin stands out as the optimal solution for tailoring WooCommerce order emails to align with your specific business needs.
The plugin not only makes visual changes but also enables you to incorporate custom static or dynamic data into your emails using shortcodes. For instance, as shown in the image below, you can add the name of the customer who placed the order to the email body using the {customer_username} shortcode.
The plugin offers a variety of useful shortcodes. However, there are situations where you might need to include a custom shortcode to present specific data. Follow the provided steps to add a custom shortcode to the plugin, and then you can use that shortcode in emails as shown above.
Adding a custom shortcode to the plugin
A custom shortcode can be created using the following code snippets. The code snippets differ for WooCommerce mail and WordPress mail. Copy the appropriate code snippet, and go to the WordPress dashboard, select Appearance > Theme File Editor.
- Find the Theme functions (functions.php) file.
- Paste the code snippet at the end of the text editor.
- Alternatively, you can utilize a code snippet plugin to add the code.
- On line four of the code snippet, you will find a variable named {custom_data}. This serves as your shortcode identifier. If you prefer a personalized name for the shortcode, simply substitute the content within the curly brackets with your desired term.
- Line four contains a placeholder, Actual data to replace, where you can substitute any static or dynamic content. The email will display this content upon adding the custom shortcode.
- Now save the file.
Snippet for WooCommerce Emails
Snippet for WordPress Emails
The additional shortcode will not appear on the list like other shortcodes. However, you can utilize this shortcode within the email body text