Hey,
If you are using the woocommerce mail system then it should use this plugins styles because it hooks into that mailer. Are you overriding any templates in your site?
Ben
no I did not copy it into my theme folder, but when I use that line of code, it is using the customized template but not the customized content/body text
Wait no, it is not in customized template. If I change the status manually from on-hold to processing it sends the customized version of the email but if I send it from the code it is the original version.
-
This reply was modified 7 years, 4 months ago by
quostudio. Reason: Additional Information
I tried to use the email id too, but it does not work. Both customized version and original version share the same id. But when I code it to send a mail with id customer_processing_order it sends the original version. I am stuck. Please kindly help.
Hey,
I guess I am confused, why are you trying to send customer_processing_order emails if the order is not processing. But I’m sure that is your issue. If you are going to do this you are going to have to manipulate the order data before you send it to the mailer and you can’t use trigger, you need to use the send function.
Something like this for example:
$wc_emails = WC_Emails::instance();
$emails = $wc_emails->get_emails();
if ( isset( $emails['WC_Email_Customer_Processing_Order'] ) && is_object( $emails['WC_Email_Customer_Processing_Order] ) ) {
$email = $emails['WC_Email_Customer_Processing_Order'];
};
$order = wc_get_order( $order_id );
if ( isset( $email ) ) {
// Make sure gateways are running in case the email needs to input content from them.
WC()->payment_gateways();
// Make sure shipping is running in case the email needs to input content from it.
WC()->shipping();
$email->object = $order;
$email->find['order-date'] = '{order_date}';
$email->find['order-number'] = '{order_number}';
if ( is_object( $order ) ) {
$email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
$email->replace['order-number'] = $email->object->get_order_number();
// Other properties
$email->recipient = $email->object->get_billing_email();
}
if ( $email->get_recipient() ) {
$email->send( $email->get_recipient(), $email->get_subject(), $email->get_content(), $email->get_headers(), $email->get_attachments() );
}