WooCommerce doesn’t automatically send a payment request email when an order is placed with the “Pending Payment” status. The “Customer Invoice / Order Details” email, which is meant to prompt payment from the customer, needs to be manually sent by the store admin.
This is a major hassle for stores that:
- Create orders manually via the admin
- Use offline payment gateways (like bank transfer or COD)
- Sell to clients who prefer to pay only after receiving a formal invoice
If you want to automatically send this email the moment an order is marked as pending without clicking anything—this guide is for you.
What is the “Customer Invoice / Order Details” Email in WooCommerce?
WooCommerce includes several order email notifications, but the Customer Invoice is a unique one:
- Used to request payment from the customer
- Not triggered automatically on order creation (unlike “Processing” or “Completed” emails)
- Must be sent manually via the “Order Actions” dropdown
If your workflow depends on getting customers to pay later or offline, then automating this process is a huge time-saver.
The Problem With Manual Order Emails
Let’s say you create an order from the admin:
- Add products to the cart
- Assign a customer
- Save as “Pending Payment”
At this point, the customer receives… nothing.
You now need to:
- Open the order
- Manually click “Resend customer invoice” in Order Actions
Why isn’t this automatic? Great question. Let’s fix it.
Solution: Automatically Send Pending Order Email via PHP Snippet
Here’s a clean, lightweight PHP snippet that works with WooCommerce 9+. It ensures that as soon as a new order is placed or manually created and set to pending, the invoice email is triggered automatically.
📌 Add this to your theme’s functions.php
file, or better yet, use a custom plugin for performance and maintainability.
PHP Snippet (Latest – Recommended):
/**
* Automatically Send WooCommerce Customer Invoice Email for Pending Orders
* @author Rodolfo Melogli - Modified by Vishrut Gaudani
* @compatible WooCommerce 9+
* @tutorial https://businessbloomer.com/woocommerce-customization
*/
add_action( 'woocommerce_new_order', 'auto_send_pending_invoice_email', 9999, 2 );
function auto_send_pending_invoice_email( $order_id, $order ) {
if ( ! $order instanceof WC_Order ) {
$order = wc_get_order( $order_id );
}
if ( 'pending' !== $order->get_status() || ! $order->needs_payment() ) {
return;
}
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->customer_invoice( $order );
$order->add_order_note( __( 'Customer invoice automatically sent for pending order.', 'your-textdomain' ), false, true );
}
Alternative: Legacy Snippet (Trigger on Status Change)
If you only want the email to send when an existing order is changed to “pending” (instead of being newly created), this version is for you:
add_action( 'woocommerce_order_status_pending', 'auto_send_invoice_on_pending', 9999, 2 );
function auto_send_invoice_on_pending( $order_id, $order ) {
if ( ! $order->needs_payment() ) return;
WC()->payment_gateways();
WC()->shipping();
WC()->mailer()->customer_invoice( $order );
$order->add_order_note( __( 'Invoice email automatically sent on status change to pending.', 'your-textdomain' ), false, true );
}
SEO Keywords You’re Targeting (Embedded):
- WooCommerce send pending order email automatically
- Auto-send WooCommerce customer invoice
- How to trigger WooCommerce invoice email
- WooCommerce PHP snippet to send email
- Automatically email invoice in WooCommerce
Pro Tips
- Always test on a staging site before deploying to live.
- Use plugins like WP Mail Logging to confirm that emails are triggered correctly.
- Combine this with custom email templates to improve the branding of your invoice.
Bonus: What if the Email Still Doesn’t Send?
- Make sure WooCommerce email settings have “Customer Invoice / Order Details” enabled.
- Ensure that your email is not being blocked or marked as spam (use SMTP plugins like WP Mail SMTP).
- Confirm that the order has a valid billing email and the status is truly “pending”.