public function updateOrderPrice(OrderInterface $order, PricingContextInterface $context = null) { if ($this->localProcessing) { $cartTotal = 0; foreach ($order->getItems() as $item) { $price = $item->getPrice(); $subtotal = $price * $item->getQuantity(); $item->setPrice($subtotal, 'subtotal'); $cartTotal += $subtotal; } $order->setTotalPrice($cartTotal); } $orderEvents = $this->eventsClass; $this->eventDispatcher->dispatch($orderEvents::UPDATE_ORDER_PRICE, $this->eventDispatcher->createEvent(array($order, $context))); }