此解决方案有效。
<?php
if ( ! defined( \'ABSPATH\' ) ) {
exit;
}
foreach ($order->get_items() as $item_id => $item) {
$product_name = $item[\'name\']; // product name
}
/**
* @hooked WC_Emails::email_header() Output the email header
*
*/
do_action( \'woocommerce_email_header\', $email_heading, $email );
?>
<p><?php printf( __( "Your recent order has been completed, \'woocommerce\' ), $product_name ); ?></p>
<p>
<?php echo wp_get_attachment_image( 1096, array(\'219\', \'98\'), "", array(
\'name\' => \'logo\',
\'align\' => \'left\', // Not supported in HTML5
\'border\' => \'0\', // Not supported in HTML5
\'width\' => \'219\',
\'height\' => \'98\'
) ); ?>
</p>
添加后
<p>
<?php echo wp_get_attachment_image( 1096, array(\'219\', \'98\'), "", array(
\'name\' => \'logo\',
\'align\' => \'left\', // Not supported in HTML5
\'border\' => \'0\', // Not supported in HTML5
\'width\' => \'219\',
\'height\' => \'98\'
) ); ?>
</p>
图像显示在电子邮件中。