diff --git a/includes/class-wc-customer.php b/includes/class-wc-customer.php index 62dc0de0b5d..11ac3d21544 100644 --- a/includes/class-wc-customer.php +++ b/includes/class-wc-customer.php @@ -991,10 +991,10 @@ class WC_Customer extends WC_Legacy_Customer { update_user_meta( $this->get_id(), 'last_update', $this->get_date_modified() ); update_user_meta( $this->get_id(), 'first_name', $this->get_first_name() ); update_user_meta( $this->get_id(), 'last_name', $this->get_last_name() ); - $this->set_date_modified( time() ); wp_update_user( array( 'ID' => $this->get_id(), 'role' => $this->get_role() ) ); $wp_user = new WP_User( $this->get_id() ); $this->set_date_created( strtotime( $wp_user->user_registered ) ); + $this->set_date_modified( get_user_meta( $this->get_id(), 'last_update', true ) ); $this->read_meta_data(); } } @@ -1074,11 +1074,10 @@ class WC_Customer extends WC_Legacy_Customer { update_user_meta( $this->get_id(), 'shipping_state', $this->get_shipping_state() ); update_user_meta( $this->get_id(), 'shipping_country', $this->get_shipping_country() ); update_user_meta( $this->get_id(), 'paying_customer', $this->get_is_paying_customer() ); - $this->set_date_modified( time() ); - update_user_meta( $this->get_id(), 'last_update', $this->get_date_modified() ); update_user_meta( $this->get_id(), 'first_name', $this->get_first_name() ); update_user_meta( $this->get_id(), 'last_name', $this->get_last_name() ); wp_update_user( array( 'ID' => $this->get_id(), 'role' => $this->get_role() ) ); + $this->set_date_modified( get_user_meta( $this->get_id(), 'last_update', true ) ); $this->save_meta_data(); } diff --git a/tests/unit-tests/customer/crud.php b/tests/unit-tests/customer/crud.php index a27d4d93388..9dedb3bf0de 100644 --- a/tests/unit-tests/customer/crud.php +++ b/tests/unit-tests/customer/crud.php @@ -80,10 +80,6 @@ class WC_Tests_CustomerCRUD extends WC_Unit_Test_Case { $customer_id = $customer->get_id(); $this->assertNotEquals( 0, $customer->get_id() ); $customer->delete(); - - $user_object = get_user_by( 'id', $customer_id ); - $this->assertFalse( $user_object ); - $customer->read( $customer_id ); $this->assertEquals( 0, $customer->get_id() ); }