From fa2280f3f82c531d072d5aea62e0dac0187126f5 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 29 Feb 2016 12:33:09 +0000 Subject: [PATCH] Add notice on fail --- includes/abstracts/abstract-wc-order.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index 0480618d70d..64140a8c6f0 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -2298,7 +2298,10 @@ abstract class WC_Abstract_Order { $update_post_data[ 'post_date_gmt' ] = current_time( 'mysql', 1 ); } - wp_update_post( $update_post_data ); + if ( ! wp_update_post( $update_post_data ) ) { + $this->add_order_note( sprintf( __( 'Unable to update order from %s to %s.', 'woocommerce' ), wc_get_order_status_name( $old_status ), wc_get_order_status_name( $new_status ) ), 0, $manual ); + return false; + } $this->add_order_note( trim( $note . ' ' . sprintf( __( 'Order status changed from %s to %s.', 'woocommerce' ), wc_get_order_status_name( $old_status ), wc_get_order_status_name( $new_status ) ) ), 0, $manual );