diff --git a/modules/order/src/Element/ProfileSelect.php b/modules/order/src/Element/ProfileSelect.php
index 3b09fb1..619005c 100644
--- a/modules/order/src/Element/ProfileSelect.php
+++ b/modules/order/src/Element/ProfileSelect.php
@@ -3,9 +3,13 @@
 namespace Drupal\commerce_order\Element;
 
 use Drupal\commerce\Element\CommerceElementBase;
+use Drupal\Component\Utility\Html;
+use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\profile\Entity\ProfileInterface;
+use Drupal\profile\Entity\Profile;
+use Symfony\Component\HttpFoundation\Request;
 
 /**
  * Provides a form element for selecting a customer profile.
@@ -44,6 +48,9 @@ class ProfileSelect extends CommerceElementBase {
         [$class, 'attachElementSubmit'],
         [$class, 'processForm'],
       ],
+      '#after_build' => [
+        [$class, 'afterBuild'],
+      ],
       '#element_validate' => [
         [$class, 'validateElementSubmit'],
         [$class, 'validateForm'],
@@ -84,6 +91,71 @@ class ProfileSelect extends CommerceElementBase {
     }
 
     $element['#profile'] = $element['#default_value'];
+
+    $pane_id = $element['#name'];
+    $mode = 'view';
+
+    $profile_selection_parents = $element['#parents'];
+    $profile_selection_parents[] = 'profile_selection';
+    $profile_id = $form_state->getValue($profile_selection_parents);
+    $storage = $form_state->getStorage();
+    if ($profile_id && $profile_id == 'new_address') {
+      $mode = 'new';
+    }
+    // If an AJAX rebuild happened, we might have our data in form state.
+    elseif (!empty($storage['pane_' . $pane_id])) {
+      $profile = $storage['pane_' . $pane_id]['profile'];
+      $mode = $storage['pane_' . $pane_id]['mode'];
+    }
+
+    $ajax_wrapper_id = Html::getUniqueId('profile-select-ajax-wrapper');
+    // Prefix and suffix used for Ajax replacement.
+    $element['#prefix'] = '<div id="' . $ajax_wrapper_id . '">';
+    $element['#suffix'] = '</div>';
+
+    $profile_uid = $element['#profile']->getOwnerId();
+    $profile_ids = \Drupal::service('entity.query')
+      ->get('profile')
+      ->condition('uid', $profile_uid)
+      ->condition('status', TRUE)
+      ->sort('profile_id', 'DESC')
+      ->execute();
+    $profiles =  Profile::loadMultiple($profile_ids);
+    $profile_options = [];
+    /** @var Profile $profile */
+    foreach ($profiles as $profile_option) {
+      if (!isset($default_profile_id)) {
+        $default_profile_id = $profile_option->id();
+        $default_profile = $profile_option;
+      }
+      $profile_options[$profile_option->id()] = $profile_option->label();
+    }
+    $profile_options['new_address'] = t('+ Enter a new address');
+
+    // No profile set yet. First see if one exists already.
+    if (empty($profile)) {
+      if (!$profiles) {
+        // No profiles found. Create a new one.
+        $values = [
+          'type' => $element['#profile']->bundle(),
+          'uid' =>  $element['#profile']->getOwnerId(),
+        ];
+        $profile = Profile::create($values);
+        $mode = 'new';
+      }
+      else {
+        $profile = $default_profile;
+      }
+    }
+
+    // Remember the current profile and mode in form state.
+    $storage['pane_' . $pane_id] = [
+      'profile' => $profile,
+      'mode' => $mode,
+    ];
+    $form_state->setStorage($storage);
+    $element['#profile'] = $profile;
+
     $form_display = EntityFormDisplay::collectRenderDisplay($element['#profile'], 'default');
     $form_display->buildForm($element['#profile'], $element, $form_state);
     if (!empty($element['address']['widget'][0])) {
@@ -100,9 +172,80 @@ class ProfileSelect extends CommerceElementBase {
       }
     }
 
+    $called_class = get_called_class();
+    if ($profile_options && $mode != 'edit') {
+      \Drupal::moduleHandler()->alter('commerce_addressbook_labels', $profile_options, $profiles);
+
+      $element['profile_selection'] = [
+        '#title' => t('Select an address'),
+        '#options' => $profile_options,
+        '#type' => 'select',
+        '#weight' => -5,
+        '#default_value' => $default_profile_id,
+        '#ajax' => [
+          'callback' => [$called_class, 'profileSelectAjax'],
+          'wrapper' => $ajax_wrapper_id,
+        ],
+        '#element_validate' => [[$called_class, 'profileSelectValidate']],
+      ];
+    }
+
+    if ($mode == 'view') {
+      $view_builder = \Drupal::entityTypeManager()
+        ->getViewBuilder('profile');
+      $content = $view_builder->view($profile, 'default');
+
+      $element['rendered_profile'] = [
+        $content,
+      ];
+      $element['edit_button'] = [
+        '#type' => 'button',
+        '#name' => 'pane-' . $pane_id . '-edit',
+        '#value' => t('Edit'),
+        '#limit_validation_errors' => [],
+        '#ajax' => [
+          'callback' => [$called_class, 'profileSelectAjax'],
+          'wrapper' => $ajax_wrapper_id,
+        ],
+        '#element_validate' => [[$called_class, 'profileEditValidate']],
+      ];
+      $element['address']['#access'] = FALSE;
+    }
+    else {
+      // Add the field widgets for the profile.
+      if ($profiles) {
+
+        $element['cancel_button'] = [
+          '#type' => 'button',
+          '#name' => 'pane-' . $pane_id . '-cancel',
+          '#value' => t('Return to address selection'),
+          '#limit_validation_errors' => [],
+          '#ajax' => [
+            'callback' => [$called_class, 'profileSelectAjax'],
+            'wrapper' => $ajax_wrapper_id,
+          ],
+          '#element_validate' => [[$called_class, 'profileSelectCancel']],
+        ];
+      }
+    }
+
     return $element;
   }
 
+  public static function afterBuild(array $element, FormStateInterface $form_state) {
+    $triggering_element = $form_state->getTriggeringElement();
+    if ($triggering_element) {
+      $last_parent = array_pop($triggering_element['#parents']);
+      if ($last_parent == 'edit_button') {
+        $element['address']['#access'] = TRUE;
+        $element['edit_button']['#access'] = FALSE;
+        $element['rendered_profile']['#access'] = FALSE;
+        $element['profile_selection']['#access'] = FALSE;
+      }
+    }
+    //if ($triggering_element['#parents'])
+    return $element;
+  }
   /**
    * Validates the element form.
    *
@@ -116,9 +259,12 @@ class ProfileSelect extends CommerceElementBase {
    *   form, as a protection against buggy behavior.
    */
   public static function validateForm(array &$element, FormStateInterface $form_state) {
-    $form_display = EntityFormDisplay::collectRenderDisplay($element['#profile'], 'default');
-    $form_display->extractFormValues($element['#profile'], $element, $form_state);
-    $form_display->validateFormValues($element['#profile'], $element, $form_state);
+    $triggering_last_parent = array_pop($form_state->getTriggeringElement()['#parents']);
+    if (!in_array($triggering_last_parent, ['edit_button', 'cancel_button'])) {
+      $form_display = EntityFormDisplay::collectRenderDisplay($element['#profile'], 'default');
+      $form_display->extractFormValues($element['#profile'], $element, $form_state);
+      $form_display->validateFormValues($element['#profile'], $element, $form_state);
+    }
   }
 
   /**
@@ -135,4 +281,66 @@ class ProfileSelect extends CommerceElementBase {
     $element['#profile']->save();
   }
 
+  public static function profileSelectAjax(&$form, FormStateInterface &$form_state, Request $request) {
+    $triggering_element = $form_state->getTriggeringElement();
+    array_pop($triggering_element['#array_parents']);
+    $element = NestedArray::getValue($form, $triggering_element['#array_parents']);
+    return $element;
+  }
+
+  public static function profileSelectValidate(array $element, FormStateInterface $form_state) {
+    $triggering_element = $form_state->getTriggeringElement();
+    if (in_array('profile_selection', $triggering_element['#parents']) && $triggering_element['#id'] == $element['#id']) {
+      $form = $form_state->getCompleteForm();
+      $profile_element_parents = $element['#parents'];
+      array_pop($profile_element_parents);
+      $profile_element = NestedArray::getValue($form, $profile_element_parents);
+      $pane_id = $profile_element['#name'];
+      $storage = $form_state->getStorage();
+
+      // If the user wants to enter a new address.
+      if ($element['#value'] == 'new_address') {
+        $storage['pane_' . $pane_id]['mode'] = 'edit';
+        $values = [
+          'type' => $profile_element['#profile']->bundle(),
+          'uid' =>  $profile_element['#profile']->getOwnerId(),
+        ];
+        $profile = Profile::create($values);
+        $storage['pane_' . $pane_id]['profile'] = $profile;
+      }
+      else {
+        $storage['pane_' . $pane_id]['mode'] = 'view';
+        $profile_id = $form_state->getValue($element['#parents']);
+        $storage['pane_' . $pane_id]['profile'] = Profile::load($profile_id);
+      }
+      $form_state->setStorage($storage);
+    }
+  }
+
+  public static function profileEditValidate(array &$element, FormStateInterface $form_state) {
+    $triggering_element = $form_state->getTriggeringElement();
+    if ($triggering_element) {
+      $last_parent = array_pop($triggering_element['#parents']);
+      if ($last_parent == 'edit_button') {
+        $complete_form = $form_state->getCompleteForm();
+        array_pop($element['#parents']);
+        $element = NestedArray::getValue($complete_form, $element['#parents']);
+        $pane_id = $element['#name'];
+        $storage = $form_state->getStorage();
+        $storage['pane_' . $pane_id]['mode'] = 'edit';
+        $form_state->setStorage($storage);
+      }
+    }
+  }
+
+  public static function profileSelectCancel(array &$element, FormStateInterface $form_state) {
+    $complete_form = $form_state->getCompleteForm();
+    array_pop($element['#parents']);
+    $element = NestedArray::getValue($complete_form, $element['#parents']);
+    $pane_id = $element['#name'];
+    $storage = $form_state->getStorage();
+    unset($storage['pane_' . $pane_id]);
+    $form_state->setStorage($storage);
+  }
+
 }
