You are here

public function OrderEventsSubscriber::onOrderCreate in Commerce Demo 8

Reacts to an order being created..

Parameters

\Drupal\commerce_order\Event\OrderEvent $event: The order event.

File

src/EventSubscriber/OrderEventsSubscriber.php, line 25

Class

OrderEventsSubscriber

Namespace

Drupal\commerce_demo\EventSubscriber

Code

public function onOrderCreate(OrderEvent $event) {
  $order = $event
    ->getOrder();
  if ($order
    ->getCustomer()
    ->isAnonymous()) {
    $order
      ->setEmail(sprintf('demo+%s@commercekickstart.com', time()));
  }
}