The “Customer invoice/ Order details” WooCommerce email notification template is used manually by store owners when sending payment requests to customers. This email template is a perfect choice for sending pending payment reminders as well.
What we will be doing in this post is to use the Cusotmer invoice/ Order detail email template to send payment reminder notifications. To make it a bit smarter, we will make the reminder email triggered automatically when the order status transitioned to “pending payment”
Solution:Send Email for Pending Payment Status To Customers in WooCommerce
The code snippet will send a email notification to customers for pending payment order status.
add_action( 'woocommerce_order_status_pending', 'ts_send_pending_order_email', 10, 2 ); function ts_send_pending_order_email( $order_id, $order ) { if ( ! $order->needs_payment() ) return; WC()->payment_gateways(); WC()->shipping(); // Send customer invoice email WC()->mailer()->customer_invoice( $order ); // Add order note $order->add_order_note( __( 'Payment request automatically sent to customer.' ), false, true ); }
Output
Whenever the order status is changed to ‘pending payment’ the customer invoice email is triggered and will be sent to the customer email notifications as shown below.
Alternatively, if you want to keep the site admins in the loop, you can send processing order email to admin email notifications. This helps the admin to track the processing stage of the order