• Resolved teresasumisu

    (@teresasumisu)


    Hi!
    I need to send the Order Confirmation E-Mail after the Order/Payment is completed.
    I am doing this in the below code
    But when I do this, no settings of the Order Confirmation E-Mail I’ve set in WooCommerce > Settings > E-Mails > Order Confirmation get applied, so the Subject stays the same as default WC, Confirmation Text stays the same as default…

    The Confirmation gets sent on the normal WC way, after the Order is made, the right Subject etc from the settings is applied.

    add_action( 'woocommerce_payment_complete', 'lw_payment_complete' );
    function lw_payment_complete( $order_id ){
        $mails  = WC()->mailer()->emails;
        $email_o = $mails['WC_Email_Customer_Completed_Order'];
        //it does not matter if i take this $email_o = new WC_Email_Customer_Completed_Order(); instead of the 2 rows above.
        $email_o->trigger($order_id);
    }
    • This topic was modified 5 years, 1 month ago by teresasumisu.
Viewing 2 replies - 1 through 2 (of 2 total)
  • madeincosmos

    (@madeincosmos)

    Automattic Happiness Engineer

    Hi @teresasumisu,

    I understand you’d like to send the Order Completed email immediately to the customer as soon as they pay for the order, is that correct?

    If that’s the case, have you considered making the product both Virtual and Downloadable?

    You can make a product Downloadable without attaching any downloadable files to it, and when you do this, the order will skip the Processing status and automatically go to Completed as soon as the order is paid. This way, the custom code won’t be necessary.

    Do you think this could work for you?

    Plugin Support EtienneP a11n

    (@etiennep)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘E-Mail Settings don’t apply in woocommerce_payment_complete’ is closed to new replies.