Last active
August 25, 2023 20:32
-
-
Save ko31/ad7b84f243808486c362711d1e294bcc to your computer and use it in GitHub Desktop.
How to send an email manually using WooCommerce email templates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load the WooCommerce email templates. | |
$wc_emails = WC()->mailer()->get_emails(); | |
/** | |
* You can specify which template mail is to be sent from the following array elements. | |
* 'WC_Email_New_Order' | |
* 'WC_Email_Cancelled_Order' | |
* 'WC_Email_Failed_Order' | |
* 'WC_Email_Customer_On_Hold_Order' | |
* 'WC_Email_Customer_Processing_Order' | |
* 'WC_Email_Customer_Completed_Order' | |
* 'WC_Email_Customer_Refunded_Order' | |
* 'WC_Email_Customer_Invoice' | |
* 'WC_Email_Customer_Note' | |
* 'WC_Email_Customer_Reset_Password' | |
* 'WC_Email_Customer_New_Account' | |
*/ | |
// Set the recipeent. | |
$wc_emails['WC_Email_New_Order']->recipient = '[email protected]'; | |
// If you want to change the email type, you can set it from 'html', 'multipart', or 'plain'. | |
//$wc_emails['WC_Email_New_Order']->email_type = 'plain'; | |
// Trigger the sending of an email to the order ID. | |
$order_id = 1; | |
$wc_emails['WC_Email_New_Order']->trigger( $order_id ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment