Table of Contents
As a WooCommerce store owner, it’s crucial to stay informed about your customers’ payment status to ensure seamless transactions and provide timely support when issues arise. One effective way to achieve this is by setting up email notifications for failed or pending payments.
We’ll walk you through the process of enabling email notifications for both failed and on-hold orders in WooCommerce, which could serve a similar purpose for pending payments.
Image: https://woocommerce.com
Configuring Failed Payment Email Notifications in WooCommerce
- Log in to your WordPress admin dashboard.
- From the left-hand menu, hover over “WooCommerce” and click on “Settings.”
- In the “Settings” section, click on the “Emails” tab located at the top of the page.
- On the “Emails” tab, you’ll see a list of various email notifications that WooCommerce can send. To enable notifications for failed payments, click on the “Failed order” row or the “Manage” button located at the right side of that row.
- In the “Failed order” settings, check the “Enable this email notification” box.
- Customize the email subject, heading, and content as desired. You can use placeholders like
{site_title}
and{order_number}
to include dynamic information in the email. - In the “Recipient(s)” field, enter the email address(es) where you want to receive the notifications. To add multiple recipients, separate the email addresses with a comma.
- Click “Save changes” to save your settings.
Unfortunately, WooCommerce does not have a built-in email notification specifically for “Pending payment” orders. However, you can set up an email notification for “On hold” orders, which could serve a similar purpose, as payments might still be pending for those orders.
To enable email notifications for “On hold” orders, follow the same process as above, but click on the “On hold order” row or the “Manage” button next to it in step 4.
By enabling these email notifications, you’ll be informed about orders with failed or potentially pending payments, allowing you to take appropriate action.
Understanding WooCommerce Order Statuses: "Pending Payment" vs. "On Hold"
In WooCommerce, “On hold” and “Pending payment” are two different order statuses that represent different stages in the order processing lifecycle.
Here’s a brief explanation of each status:
Pending payment: The “Pending payment” status indicates that an order has been received by the system but has not yet been paid for by the customer. This status typically applies to orders where the customer has chosen a manual payment method, such as bank transfer or check payments. The order will remain in this status until the payment is received and confirmed. Once the payment is confirmed, the order status will change to “Processing” or another appropriate status based on the payment gateway and product type.
On hold: The “On hold” status signifies that an order has been received and paid for, but requires action before it can be processed further. This status is often used when a store owner needs to verify payment details or other information before fulfilling the order. For example, if the customer’s payment method is flagged as potentially fraudulent or if there’s an issue with the shipping address, the order may be placed “On hold” while the store owner investigates and resolves the issue. Once the necessary action has been taken, the order status can be changed to “Processing” or another relevant status.
In summary, the main difference between “Pending payment” and “On hold” in WooCommerce is that the former indicates an order is awaiting payment, while the latter means the order has been paid for but requires further action before it can be processed.
Free Solution: Adding Code
// New order notification only for "Pending" Order status
add_action( 'woocommerce_checkout_order_processed', 'pending_new_order_notification', 20, 1 );
function pending_new_order_notification( $order_id ) {
// Get an instance of the WC_Order object
$order = wc_get_order( $order_id );
// Only for "pending" order status
if( ! $order->has_status( 'pending' ) ) return;
// Get an instance of the WC_Email_New_Order object
$wc_email = WC()->mailer()->get_emails()['WC_Email_New_Order'];
## -- Customizing Heading, subject (and optionally add recipients) -- ##
// Change Subject
$wc_email->settings['subject'] = __('{site_title} - New customer Pending order ({order_number}) - {order_date}');
// Change Heading
$wc_email->settings['heading'] = __('New customer Pending Order');
// $wc_email->settings['recipient'] .= ',name@email.com'; // Add email recipients (coma separated)
// Send "New Email" notification (to admin)
$wc_email->trigger( $order_id );
}
To add the provided code snippet to your WordPress site, you can follow these steps:
- Log in to your WordPress admin dashboard.
- Go to
Appearance
>Theme Editor
. This will open the theme editor where you can edit the files of your active theme. Please note that editing the theme files directly might cause issues, and it’s always recommended to create a child theme or use a custom plugin for such customizations. - Locate the
functions.php
file in the right-hand file list. It’s usually under the “Theme Files” section. - Click on the
functions.php
file to open it in the editor. - Scroll down to the bottom of the file, and paste the provided code snippet right before the closing PHP tag (
?>
) if it’s present. If there’s no closing PHP tag, just paste the code at the end of the file. - Click the “Update File” button to save your changes.
Now, the code snippet will be active on your site, and you should receive new order email notifications for orders with the “Pending” status.
While the core WooCommerce plugin doesn’t provide a built-in email notification specifically for “Pending payment” orders, you can still achieve this functionality by using third-party plugins. One such plugin is AutomateWoo, which allows you to send customized email notifications for any order status, including pending payments.
AutomateWoo: https://automatewoo.com/
To get started with AutomateWoo, follow these steps:
- Purchase, install, and activate the AutomateWoo plugin on your WordPress website.
- Navigate to the AutomateWoo dashboard in your WordPress admin area.
- Click “Workflows” in the AutomateWoo menu, and then click “Add New” to create a new workflow.
- Configure the workflow settings, such as the trigger, action, and rules. For the trigger, choose “Order Status Changes,” and set the initial status to “Any” and the target status to “Pending payment.”
- For the action, select “Send Email,” and then customize the email subject, heading, and content as desired.
- Optionally, set up rules to further refine when the email is sent, such as restricting it to specific products or categories.
- Save and activate the workflow to start sending email notifications for pending payment orders.
By using plugins like AutomateWoo, you can enhance the email notification capabilities of your WooCommerce store and keep both you and your customers informed about pending payment orders.
By following the steps outlined in this guide, you have now enabled email notifications for failed and on-hold orders in WooCommerce. This not only helps you stay informed about payment issues but also allows you to take proactive measures in addressing these problems, ensuring a smoother customer experience.
Sources / More Information:
https://wordpress.org/support/topic/not-receiving-notification-of-pending-payment-orders/
https://docs.woocommerce.com/document/configuring-woocommerce-settings/#email-settings
https://stackoverflow.com/questions/45375143/send-an-email-notification-to-the-admin-for-pending-order-status-in-woocommerce
AutomateWoo