In this tutorial i will help you how to add Pending Payment Reminder in Woocommerce.
Please copy this code below to your child theme functions.php
// WC Order Pending Payment Reminder add_action( 'restrict_manage_posts', 'on_hold_payment_reminder' ); function pending_payment_reminder() { global $pagenow, $post_type; if( 'shop_order' === $post_type && 'edit.php' === $pagenow && get_option( 'unpaid_orders_reminder_daily_process' ) < time() ) : $days_delay = 1; // 24 hours $one_day = 24 * 60 * 60; $today = strtotime( date('Y-m-d') ); $unpaid_orders = (array) wc_get_orders( array( 'limit' => -1, 'status' => 'pending', 'date_created' => '<' . ( $today - ($days_delay * $one_day) ), ) ); if ( sizeof($unpaid_orders) > 0 ) { $reminder_text = __("Payment reminder email sent to customer $today.", "woocommerce"); foreach ( $unpaid_orders as $order ) { $order->update_meta_data( '_send_on_hold', true ); $order->update_status( 'reminder', $reminder_text ); $wc_emails = WC()->mailer()->get_emails(); // Get all WC_emails objects instances $wc_emails['WC_Email_Customer_On_Hold_Order']->trigger( $order->get_id() ); // Send email } } update_option( 'unpaid_orders_reminder_daily_process', $today + $one_day ); endif; } add_action ( 'woocommerce_email_order_details', 'on_hold_payment_reminder_notification', 5, 4 ); function on_hold_payment_reminder_notification( $order, $sent_to_admin, $plain_text, $email ){ if ( 'customer_on_hold_order' == $email->id && $order->get_meta('_send_on_hold') ){ $order_id = $order->get_id(); $order_link = wc_get_page_permalink('myaccount').'view-order/'.$order_id.'/'; $order_number = $order->get_order_number(); echo '<h2>'.__("Do not forget about your order.").'</h2> <p>'.sprintf( __("please login to your account here… %s"), '<a href="'.$order_link.'">'.__("Your My account order #").$order_number.'<a>' ) .'</p>'; $order->delete_meta_data('_send_on_hold'); $order->save(); } }