Hi @johnegg,
First solution that comes to mind – rewrite WooCommerce email templates in your theme. Actually, standard processing email text (“Just to let you know β we’ve received your order…”) is hardcoded in the template, so I don’t see any other option for this.
So what you need to do:
1. Leave “Email instructions” option empty in custom gateway’s settings. This way it won’t appear in manual invoice emails and won’t interfere with our customizations below.
2. Copy customer-processing-order.php file from \wp-content\plugins\woocommerce\templates\emails to \wp-content\themes\your_theme\woocommerce\emails. Ideally your_theme would be a child theme – this way customizations won’t disappear after theme update.
3. Open copied customer-processing-order.php file in your theme folder (e.g. with FTP) and change line 30 from:
<p><?php printf( esc_html__( 'Just to let you know — we\'ve received your order #%s, and it is now being processed:', 'woocommerce' ), esc_html( $order->get_order_number() ) ); ?></p>
to something like this:
<p><?php
if ( 'alg_custom_gateway_1' === $order->get_payment_method() ) {
echo 'Your email instructions here...';
} else {
printf( esc_html__( 'Just to let you know — we\'ve received your order #%s, and it is now being processed:', 'woocommerce' ), esc_html( $order->get_order_number() ) );
}
?></p>
here we are outputting different text (“Your email instructions here…”) for orders made with alg_custom_gateway_1 payment gateway.
Hope you get the idea. Please let me know if you have any questions.
This is excellent! Thanks very much, works perfectly.
Hi Guys
Thanks again, just one question how do I add line breaks in the echoed text? If I add p tags or br tags it seems to break the header logo image in the email. No image source code.
Here is the text:
echo “Thank you for your order. Your order is currently waiting to be approved and is due for payment in 30 days. If we need any further information our support team will get in touch with you. Once it is approved your order will be sent for shipping and you will receive an order confirmation and invoice. “;
I need to add a line break before “Once it is approved…” so it goe son new paragraph.
Cheers
John
Hi @johnegg,
<p></p> or <br> should work fine. Be sure that you are not putting those inside esc_html() function though, as in this case it will just output it as raw text. If that doesn’t help, could you please post here the full PHP block of what you are changing?
Cool I think I got it working now. I was using <br /> instead of <br>
@johnegg,
Actually it should work with both of them – https://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br
Anyway, glad it’s working now. Please let me know if you need anything else. And if you like the plugin, please consider leaving me a rating.
Yeah it should, but must be some xhtml issue with using <br /> or something in WooCommerce. Its working, thats all I know! π Will leave a review sure.
@johnegg,
Thank you for the review, I really appreciate it!