Categories
WooCommerce

WooCommerce Auto Change Order Status

Change automatically the order status from “On hold” to “Processing”, to allow a customer who pay in bank transfer (which take some time) to view the digital product download link on the “Order Received” page (must refresh the page, verify that the “Grant access to downloadable products after payment” option is enabled):

add_action( 'woocommerce_thankyou', 'condless_woocommerce_auto_processing_orders' );
function condless_woocommerce_auto_processing_orders( $order_id ) {
	if ( ! $order_id ) {
		return;
	}
	$order = wc_get_order( $order_id );
	if ( $order->has_status( 'on-hold' ) ) {
        	$order->update_status( 'processing' );
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *