Answers:
你可以试试这个
$mailer = WC()->mailer();
$mails = $mailer->get_emails();
if ( ! empty( $mails ) ) {
foreach ( $mails as $mail ) {
if ( $mail->id == 'customer_completed_order' ) {
$mail->trigger( $order->id );
}
}
}
而不是像@Sumit所建议的那样循环或重用同一对象。您可以启动一个新对象,然后调用触发器。
$email_oc = new WC_Email_Customer_Completed_Order();
$email_oc->trigger($order_id);