Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Send Email for Pending Payment Status To Customers in WooCommerce ?

Send Email for Pending Payment Status To Customers in WooCommerce

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.

In this post, we will use the Customer invoice/ Order detail email template to send WooCommerce automatic payment reminder notifications. To make it a bit smarter, we will make the reminder email triggered automatically when the order status transitions to “pending payment”.

Solution: Send Email for Pending Payment Status

You can automatically send a pending order email to customers when their WooCommerce order status changes to “Pending Payment” by using the WooCommerce Customer Invoice email template and a simple code snippet.

add_action( 'woocommerce_order_status_pending', 'ts_send_pending_order_email', 10, 2 );
add_action( 'woocommerce_new_order', 'ts_send_pending_order_email', 20, 2 );

function ts_send_pending_order_email( $order_id, $order ) {
    if ( ! $order instanceof WC_Order ) {
        $order = wc_get_order( $order_id );
    }

    if ( ! $order || $order->get_status() !== 'pending' || ! $order->needs_payment() ) {
        return;
    }

    // Get WooCommerce mailer and the Customer Invoice email object
    $mailer = WC()->mailer();
    $email  = $mailer->emails['WC_Email_Customer_Invoice'];

    // Trigger the email
    $email->trigger( $order_id );

    // Add an order note for reference
    $order->add_order_note( 'Payment reminder email sent automatically for Pending Payment order.' );
}


Output

Whenever the order status is changed to ‘pending payment’, the customer invoice email is triggered and will be sent to the customer’s email notifications, as shown below.

Send Email for Pending Payment Status

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.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
12 Comments
Newest
Oldest
Inline Feedbacks
View all comments
Yeti
21 days ago

Hello, thank you, it’s work.

How to edit email pending payment? I want to add “Pay for this order” below to payment method.

Thank you

Yeti
19 days ago
Reply to  Saranya

Thank you very much

Elton
4 months ago

Thanks for the article. It looks exactly like the function that I am looking for as there are several Payment Pending orders appeared in my webstore. I copy and pasted the function in the child theme’s functions.php. I tested the function with a new order created at the backend with the order status set to “pending payment”. I click create order but no reminder email is sent. Am I missing something? does the function required any plugin other than Woocommerce?

Elton
4 months ago
Reply to  Saranya

I am very happy to let you know the script works very well. Reminder email sent both for new Payment Pending order and order that switched into Payment Pending.

I hope it will catch a few leaked customers that have a order with a failed paypal transection (it happens a lot these few days)

Ruby
1 year ago

Hi, thanks for this solution. Does this also work for new orders that are automatically set to ‘pending payment’ at the checkout? For my product, customers need to download the invoice BEFORE paying (they send it to their finance department who then pays via bank transfer).

Ruby
1 year ago
Reply to  Saranya

Thanks Saranya, I will try that. I’m not too familiar with coding in WordPress, would you mind telling me where to insert that code component? Thank you!

Valentine’s Day Big Hearts, Better Savings Sale: 20% Off on All Plugins. 25% Off on All Plugin Bundles.
12
0
Would love your thoughts, please comment.x
()
x
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.