Order Comments not showing in confirmation mails
-
Hello
One of the latest updates to WooCommerce broke the output of order comments in the admin-new-order.php mail.
I copied the new order-meta line from the current template to my own template, but it still does not output the order comments.
Here is the new file, which does work and outputs the order comments in the e-mails:
<?php /** * Admin new order email * * This template can be overridden by copying it to yourtheme/woocommerce/emails/admin-new-order.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer). * will need to copy the new files to your theme to maintain compatibility. We try to do this. * as little as possible, but it does happen. When this occurs the version of the template file will. * be bumped and the readme will list any important changes. * * @see https://docs.woothemes.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates/Emails/HTML * @version 2.5.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * @hooked WC_Emails::email_header() Output the email header */ do_action( 'woocommerce_email_header', $email_heading, $email ); ?> <p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p> <?php /** * @hooked WC_Emails::order_details() Shows the order details table. * @since 2.5.0 */ do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email ); /** * @hooked WC_Emails::order_meta() Shows order meta data. */ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email ); /** * @hooked WC_Emails::customer_details() Shows customer details * @hooked WC_Emails::email_address() Shows email address */ do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email ); /** * @hooked WC_Emails::email_footer() Output the email footer */ do_action( 'woocommerce_email_footer', $email );
And here is my file, which does not output any order comments:
<?php /** * Admin new order email * * @author WooThemes * @package WooCommerce/Templates/Emails/HTML * @version 2.0.0 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title><?php echo get_bloginfo( 'name' ); ?></title> </head> <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="font-family:arial"> <span style="font-size:24px"><?= $order->billing_first_name . ' ' . $order->billing_last_name?></span> <a href="<?php echo admin_url( 'post.php?post=' . $order->id . '&action=edit' ); ?>"> ? <?= $order->get_order_number() ?></a> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>) <br> <br> <?php do_action( 'woocommerce_email_before_order_table', $order, true, false ); ?> <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee"> <thead> <tr> <th scope="col" style="text-align:left; border: 1px solid #eee;">check</th> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'woocommerce' ); ?></th> <th scope="col" style="text-align:left; border: 1px solid #eee; font-weight:bold; font-size:1.2em"><?php _e( 'Quantity', 'woocommerce' ); ?></th> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Price', 'woocommerce' ); ?></th> </tr> </thead> <tbody> <?php echo $order->email_order_items_table( false, true ); ?> </tbody> <tfoot> <?php if ( $totals = $order->get_order_item_totals() ) { $i = 0; foreach ( $totals as $total ) { $i++; ?><tr> <th scope="row" colspan="3" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th> <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td> </tr><?php } } ?> </tfoot> </table> <?php do_action( 'woocommerce_email_after_order_table', $order, true, false ); ?> <strong style="color:black font-size:16px; white-space:pre"> <?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email ); ?> </strong> <table width="100%"> <tr> <td width="80%"> <p><?php echo $order->get_formatted_billing_address(); ?></p> <?php if ( $order->billing_email ) : ?> <p><strong><?php _e( 'Email:', 'woocommerce' ); ?></strong> <?php echo $order->billing_email; ?></p> <?php endif; ?> <?php if ( $order->billing_phone ) : ?> <p><strong><?php _e( 'Tel:', 'woocommerce' ); ?></strong> <?php echo $order->billing_phone; ?></p> <?php endif; ?> </td> <td valign="top"> <?php $barcodetype = (get_option('plugindistrict_orderbarcodes_barcodetype') == '' ? 'c128b' : get_option('plugindistrict_orderbarcodes_barcodetype')); ?> <img class="pd_order_barcode" src="https://www.barcodes4.me/barcode/<?php echo $barcodetype.'/9'.substr('000000000'.$order->id,-9); ?>.png?IsTextDrawn=1&value=<?php echo '9'.substr('000000000'.$order->id,-9);?>" /> </td> </tr> </table> <br> Bezahlt: _________________ ? [ ? ] Paypal ? [ ? ] Einzahlung ? [ ? ] Bar <br> <br> <br> Verpackt/Verschickt: ________________ ? [ ? ] CH Paket [ ? ] CH Brief ? [ ? ] A ?[ ? ] DE [ ? ] Abgeholt <br> </body> </html>
Why does
do_action( 'woocommerce_email_after_order_table', $order, true, false );
not work in my template? Is this a bug?Best Regards,
Chris
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Order Comments not showing in confirmation mails’ is closed to new replies.