You are here

public function CheckoutForm::cancel in Ubercart 8.4

Submit handler for the "Cancel" button on the checkout form.

File

uc_cart/src/Form/CheckoutForm.php, line 192

Class

CheckoutForm
The checkout form built up from the enabled checkout panes.

Namespace

Drupal\uc_cart\Form

Code

public function cancel(array &$form, FormStateInterface $form_state) {
  $order = $form_state
    ->get('order');
  if ($this->session
    ->get('cart_order') == $order
    ->id()) {
    uc_order_comment_save($order
      ->id(), 0, $this
      ->t('Customer canceled this order from the checkout form.'));
    $this->session
      ->remove('cart_order');
  }
  $this->session
    ->remove('uc_checkout_review_' . $order
    ->id());
  $this->session
    ->remove('uc_checkout_complete_' . $order
    ->id());
  $form_state
    ->setRedirect('uc_cart.cart');
}