• Hello, I really like your plugin!
    I would like to send a processing email after users click on a certain button and I have been using this on my functions.php
    $mailer[‘WC_Email_Customer_Processing_Order’]->trigger( $order_id );

    However, it sends the original version of the processing email not the edited one in Kadence and I would like to send them the edited version of the email.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Ben Ritner – Kadence WP

    (@britner)

    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

    Thread Starter quostudio

    (@quostudio)

    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

    Thread Starter quostudio

    (@quostudio)

    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
    Thread Starter quostudio

    (@quostudio)

    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.

    Plugin Contributor Ben Ritner – Kadence WP

    (@britner)

    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() );
    }
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Send the email from functions.php’ is closed to new replies.