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.
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".
The following are the steps to be done:
Creating an override for the file custom_code.php:
The first step to be done is creating the override for the app custom_code.php. To do this, navigate to "/wp-content/plugins/woo-email-customizer-page-builder/templates/woo_mail/"
Copy the file custom_code.php and paste it under "/wp-content/themes/YOUR THEME/woo-email-customizer-page-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.