diff --git a/modules/order/commerce_order.module b/modules/order/commerce_order.module
index 204cdda..429de4c 100644
--- a/modules/order/commerce_order.module
+++ b/modules/order/commerce_order.module
@@ -5,9 +5,11 @@
  * Defines the Order entity and associated features.
  */
 
+use Drupal\commerce_order\Entity\Order;
 use Drupal\commerce_order\Entity\OrderInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
 
@@ -38,6 +40,24 @@ function commerce_order_local_tasks_alter(&$definitions) {
 }
 
 /**
+ * Implements hook_ENTITY_TYPE_insert() for user entities.
+ *
+ * - Assigns any previous guest orders to new user account.
+ */
+function commerce_order_user_insert(AccountInterface $user) {
+  $order_ids = \Drupal::entityQuery('commerce_order')
+    ->condition('mail', $user->getEmail())
+    ->execute();
+  if ($order_ids) {
+    $orders = Order::loadMultiple($order_ids);
+    foreach ($orders as $order) {
+      $order->setOwnerId($user->id());
+      $order->save();
+    }
+  }
+}
+
+/**
  * Implements hook_ENTITY_TYPE_presave().
  */
 function commerce_order_commerce_order_presave(OrderInterface $order) {
diff --git a/modules/order/tests/src/Functional/OrderAccountTest.php b/modules/order/tests/src/Functional/OrderAccountTest.php
new file mode 100644
index 0000000..c965e56
--- /dev/null
+++ b/modules/order/tests/src/Functional/OrderAccountTest.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\Tests\commerce_order\Functional;
+
+use Drupal\commerce_order\Entity\Order;
+
+/**
+ * Tests the order account (owner) functionality.
+ *
+ * @group commerce
+ */
+class OrderAccountTest extends OrderBrowserTestBase {
+
+  /**
+   * Tests assigning guest orders to newly created users (after checkout).
+   */
+  public function testNewAccountOwnsOrderAfterGuestCheckout() {
+    $order_item = $this->createEntity('commerce_order_item', [
+      'type' => 'product_variation',
+    ]);
+    $order = $this->createEntity('commerce_order', [
+      'type' => 'default',
+      'uid' => 0,
+      'mail' => 'guest@example.com',
+      'order_items' => [$order_item],
+    ]);
+    $this->assertEmpty($order->getOwnerId(), 'The guest order has no owner account.');
+    $user = $this->createUser([], 'guest');
+    $order = Order::load($order->id());
+    $this->assertEquals($user->id(), $order->getOwnerId(), 'New user account owns previous guest order.');
+  }
+
+}
