vendidero / woocommerce-germanized

Adapt WooCommerce to the German Market with Germanized for WooCommerce
https://vendidero.de/woocommerce-germanized
Other
52 stars 42 forks source link

Send payment notification after order not working #87

Closed Johnny99211 closed 5 years ago

Johnny99211 commented 5 years ago

Hello,

I've tried to sent the payment notification email after the order is successfully paid but the do_action is not reachable for some reason. I can't find the problem. I'm skipping some order statuses so I need to send the payment notification with the filter to trigger it:

This is the email I'm talking about: Payment Notification E-Mail

I've tried so much the last days and this is my last hope.

My code:

add_filter( 'woocommerce_payment_complete_order_status', 'update_order_status', 10, 2 );
function update_order_status( $order_status, $order_id ) {

    do_action( 'woocommerce_order_status_pending_to_processing_notification', $order_id );

    return 'completed';
}
dennisnissle commented 5 years ago

Hi,

sorry, I guess that issue was a little overseen. You should better use the following hook:

woocommerce_payment_complete

to send the email. You'll need to call the trigger directly e.g.:

if ( $email = WC_germanized()->emails->get_email_instance_by_id( 'customer_paid_for_order' ) ) { $email->trigger( $order_id ); }

Cheers