Thread Starter
Maz
(@mouazzz)
Thanks Hellonico,
Appreciate your prompt response. I will give it a try and see.
Thanks again,
Thread Starter
Maz
(@mouazzz)
For whatever reason, this did not work 🙁
I too am having an issue. If I disable wpMandrill, the emails look fine. The way I configured WooCommerce is to copy the WP Better Emails template code to the WooCommerce emaail_header.php and email_footer.php. It works fine. The problem come ins when I enable wpMadrill. I don’t think this is a WP Better Emails problem, rather a wpMadrill problem.
A workaround is to change the email type in each of the WooCommerce emails to “Plain text”. It doesn’t look nearly as good but at least it is readable.
I’ve been hacking at this all day as I need to get this working. It seems like the problem is between this plugin and wpMandrill so the issue may not be with wpMandrill.
The order of events when you WooCommerce attempts to send an email.
1. WooCommerce creates its payload (with template if applicable).
2. WP Better Emails wraps the WC payload with its theme.
3. wpMandrill sends the WP Better Emails message.
To troubleshoot this issue, I wrote out (to the log) the payload right before Mandrill sends it (via the mandrill_payload filter). I see the WBP template code and it looks good. The problem is that the WC payload within has a bunch of “
” tags littered throughout it, within tags and completely invalidating the HTML that WC produced. It almost seems like a wierd version of wpautop was applied to it. Here’s an example.
<p>An order has been created for you on Houston Psychological<br />
Association. To pay for this order please use the following link: <a<br />
href="http://stg.jawdropdesign.com/psychologyhouston.org/checkout/order-pay/591?pay_for_order=true&key=order_54db9a9d79e32"<br />
style="color:#505050; font-weight:normal;<br />
text-decoration:underline">pay</a></p><br />
<br />
<br />
<br />
<h2 style="color:#505050; display:block; font-family:Arial;<br />
font-size:30px; font-weight:bold; margin-top:10px; margin-right:0;<br />
margin-bottom:10px; margin-left:0; text-align:left;<br />
line-height:150%">Order: #591 (<time<br />
datetime="2015-02-11T12:07:00+00:00">February 11, 2015</time>)</h2><br />
<br />
You will see that most of the tags are split with these HTML breaks. Obviously, this will prevent the email from looking right. The very temporary fix is to, within the mandrill_payload filter, remove these. Note that this will also remove any intentional breaks. It’s a much better workaround than I posted above but I’d prefer a permanent fix.
add_filter('mandrill_payload', 'my_mandrill_payload');
function my_mandrill_payload( $message ) {
$message['html'] = str_replace( "<br />", '', $message['html'] );
return $message;
}
This might be helpful. I found it while researching this problem.
I tried it and it worked for me using WP Better Emails + WooCommerce + Mandrill.
To completely remove the WooCommerce email headers and footers, leaving WP Better Emails to do them, add this to your theme’s functions.php file:
//remove WooCommerce headers and footers
function remove_woo_header_footer($object){
remove_action(‘woocommerce_email_header’, array( $object, ’email_header’ ));
remove_action(‘woocommerce_email_footer’, array( $object, ’email_footer’ ));
}
add_action( ‘woocommerce_email’, ‘remove_woo_header_footer’ );