diff --git a/includes/wc-user-functions.php b/includes/wc-user-functions.php index 448b24aebb3..676d75d9154 100644 --- a/includes/wc-user-functions.php +++ b/includes/wc-user-functions.php @@ -542,7 +542,7 @@ function wc_get_customer_order_count( $user_id ) { function wc_reset_order_customer_id_on_deleted_user( $user_id ) { global $wpdb; - $wpdb->update( $wpdb->postmeta, array( '_customer_user' => 0 ), array( '_customer_user' => $user_id ) ); + $wpdb->update( $wpdb->postmeta, array( 'meta_value' => 0 ), array( 'meta_key' => '_customer_user', 'meta_value' => $user_id ) ); } add_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );