From f9b223bc7adc6069ee01b356f81ce12e83b20915 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 31 Mar 2014 11:10:02 +0100 Subject: [PATCH] Check order exists when resuming on checkout --- includes/class-wc-checkout.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index 2513b5d8211..8fd45213837 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -189,11 +189,11 @@ class WC_Checkout { $order_id = absint( WC()->session->order_awaiting_payment ); /* Check order is unpaid by getting its status */ - $terms = wp_get_object_terms( $order_id, 'shop_order_status', array( 'fields' => 'slugs' ) ); + $terms = wp_get_object_terms( $order_id, 'shop_order_status', array( 'fields' => 'slugs' ) ); $order_status = isset( $terms[0] ) ? $terms[0] : 'pending'; // Resume the unpaid order if its pending - if ( $order_status == 'pending' || $order_status == 'failed' ) { + if ( get_post( $order_id ) && ( $order_status == 'pending' || $order_status == 'failed' ) ) { // Update the existing order as we are resuming it $create_new_order = false;