我想出了一个变通解决方案,它很管用,但不是最漂亮的:
// I made the original action passive
// do_action( \'woocommerce_email_customer_details\', $order, $sent_to_admin, $plain_text, $email );
// ... create a new solution from scratch
$text_align = is_rtl() ? \'right\' : \'left\';
//to escape # from order id
$order_id = trim(str_replace(\'#\', \'\', $order->get_order_number()));
echo $order_id;
echo \'<h2>\' . __( \'Customer comments\', \'woocommerce\' ) . \'</h2>\';
$text = apply_filters(\'the_excerpt\', get_post_field(\'post_excerpt\', $order_id));
echo $text;
?>
<table id="addresses" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0">
<tr>
<td class="td" style="text-align:<?php echo $text_align; ?>; font-family: \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
<h3><?php _e( \'Számlázási cím\', \'woocommerce\' ); ?></h3>
<?php
echo $order->get_billing_last_name() . " ";
echo $order->get_billing_first_name() . "<br />";
echo $order->get_billing_address_1() . "<br />";
echo $order->get_billing_address_2() . "<br />";
echo $order->get_billing_postcode() . "<br />";
echo $order->get_billing_email() . "<br />";
echo $order->get_billing_phone() . "<br />";
?>
</td>
<td class="td" style="text-align:<?php echo $text_align; ?>; font-family: \'Helvetica Neue\', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
<h3><?php _e( \'Shipping address\', \'woocommerce\' ); ?></h3>
<?php
echo $order->get_shipping_last_name() . " ";
echo $order->get_shipping_first_name() . "<br />";
echo $order->get_shipping_address_1() . "<br />";
echo $order->get_shipping_postcode() . "<br />";
?>
</td>
</tr>
</table>
<?php
/**
* @hooked WC_Emails::email_footer() Output the email footer
*/ ...