Php 状态更改时在woocommerce模板上发送自定义电子邮件模板

Php 状态更改时在woocommerce模板上发送自定义电子邮件模板,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我一直在试图发送html模板,我已经编码,这是无关的状态电子邮件从woocommerce。当订单的状态更改为“完成”时,我添加了一个操作挂钩。但是,我不想只发送正文并使用woocommerce的默认模板 示例: function my_awesome_publication_notification($order_id, $checkout=null) { global $woocommerce; $order = new WC_Order( $order_id ); i

我一直在试图发送html模板,我已经编码,这是无关的状态电子邮件从woocommerce。当订单的状态更改为“完成”时,我添加了一个操作挂钩。但是,我不想只发送正文并使用woocommerce的默认模板

示例:

function my_awesome_publication_notification($order_id, $checkout=null) {
    global $woocommerce;
    $order = new WC_Order( $order_id );
    if($order->status === 'completed' ) {
        // Create a mailer
        $mailer = $woocommerce->mailer();

        $message_body = __( 'Hello world!!!' );

        $message = $mailer->wrap_message(
        // Message head and message body.
        sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message_body );


        // Cliente email, email subject and message.
        $mailer->send( $order->billing_email, sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message );
    }

}
add_action("woocommerce_order_status_changed", "my_awesome_publication_notification");

是否有办法获取自定义模板文件名并将其作为文本/html电子邮件发送,而不是创建自定义模板?与
message_body=u('custom template file')类似并启动它?

我也有同样的问题。