diff --git a/modules/order/src/Form/OrderItemInlineForm.php b/modules/order/src/Form/OrderItemInlineForm.php
index 20208269..f4f2638e 100644
--- a/modules/order/src/Form/OrderItemInlineForm.php
+++ b/modules/order/src/Form/OrderItemInlineForm.php
@@ -46,13 +46,14 @@ class OrderItemInlineForm extends EntityInlineForm {
    */
   public function entityForm(array $entity_form, FormStateInterface $form_state) {
     $entity_form = parent::entityForm($entity_form, $form_state);
-    $entity_form['#entity_builders'][] = [get_class($this), 'populateTitle'];
+    $entity_form['#entity_builders'][] = [get_class($this), 'buildOrderItem'];
 
     return $entity_form;
   }
 
   /**
-   * Entity builder: populates the order item title from the purchased entity.
+   * Entity builder: populates the order item title from the purchased entity
+   * and set the reference to the order being edited.
    *
    * @param string $entity_type
    *   The entity type identifier.
@@ -63,10 +64,13 @@ class OrderItemInlineForm extends EntityInlineForm {
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The current state of the form.
    */
-  public static function populateTitle($entity_type, OrderItemInterface $order_item, array $form, FormStateInterface $form_state) {
+  public static function buildOrderItem($entity_type, OrderItemInterface $order_item, array $form, FormStateInterface $form_state) {
     $purchased_entity = $order_item->getPurchasedEntity();
-    if ($order_item->isNew() && $purchased_entity) {
-      $order_item->setTitle($purchased_entity->getOrderItemTitle());
+    if ($order_item->isNew()) {
+      if ($purchased_entity) {
+        $order_item->setTitle($purchased_entity->getOrderItemTitle());
+      }
+      $order_item->set('order_id', $form_state->getFormObject()->getEntity());
     }
   }
 
