Who doesn't want to add a personal touch to the email notifications sent to the users?
That is the purpose of the WooCommerce email-customizer with drag and drop email-builder .
However, apart from styling the email layouts, the custom shortcode feature might help you get many things done.
In our latest update of the plugin, we have made this work by auto generating the short code in the Order Meta created manually or by third party plugin.
Have a check here to add short code in a minute before checking the below method:
If you are unable to get the short code instantly, then you will have to create your custom short code like the below example.
For example, you might want to add a pre-order link to some of the products that are out of stock at the moment so that your users don't miss out their favourite products. Wondering how to achieve this?
The custom shortcode feature[woo_mb_custom_code] lets you add pre-order links on your emails, just by specifying the shortcode at the mail template in your desired position and creating an override. You could also specify the attribute type as "pre-order-link".
IMPORTANT NOTE: Custom short codes would NOT offer an instant preview in the email builder. The actual value of the custom short codes would be replaced when an actual email is sent.
Creating an override
The first step to be done is creating the override for the app custom_code.php. To do this, navigate to "/wp-content/plugins/woocommerce_email_cuztomizer_with_drag_and_drop_builder/templates/woo_mail/"
Copy the file custom_code.php and paste it under "/wp-content/themes/YOUR THEME/woocommerce_email_cuztomizer_with_drag_and_drop_builder/woo_mail/"
Now open the file and make the necessary changes as follows:
if(isset($attr['type']) && $attr['type'] == 'pre-order-link')
printf( __( "Your pre-order is now available, but requires payment. %sPlease pay for your pre-order now.%s", 'wc-pre-orders' ), '<a href="' . $order->get_checkout_payment_url() . '">', '</a>' );
Specifying the shortcode in the email template:
Post making the changes, it is essential to specify the shortcode in the template.
Navigate to the email template where you wish the pre-order link should be available.
Select the division to specify the shortcode. Add the shortcode [woo_mb_custom_code type="pre-order-link"]. The attribute type that is mentioned in the custom code should be specified in the email template for it to work.
Save the template and send a test email to check if the shortcode has taken effect.
Post creating an override and entering the shortcode in the mail template, the email notification will look like this:
Now all your order email notifications with the specified status will have the pre-order links in them.
What's Next ?
How to fetch order meta information using a custom short code