WooCommerce Replace “Thank You. Your Order Has Been Received” Text.
Pre-Requisites
There are no pre-requisites for this code snippet to work. Keep in mind this solution consists of two code snippets, one to display the content and one to style it.
How To Implement This Solution?
Add these two code snippets as separate entries in either your active child theme’s functions.php file or the Code Snippets plugin.
About The Snippet
If you’d like to bypass the on-hold order status that WooCommerce or the payment gateway automatically sets on orders and change it to the Completed order status instead, this guide is for you. Typically, store owners don’t have the Order on-hold email active; they rely on the Processing or Completed order emails. It’s uncommon for customers to receive an email saying their order is on hold, so this solution addresses that issue. It also reduces administrative overhead since your staff won’t need to log in and update each order to Completed manually—it happens automatically when the thank you page is triggered.
Code Snippet 1 (Paste This Code In functions.php or Code Snippets )
/**
* Snippet Name: Automatically set the completed order status in WooCommerce.
* Snippet Author: Nevercrox Solutions
*/
function nevercrox_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
if( 'on-hold' == $order->get_status() ) {
$order->update_status( 'completed' );
}
}
add_action( 'woocommerce_thankyou', 'nevercrox_auto_complete_order' );