/** * Performs all processes to be performed after the order creation. * * Flushes all loaded order and related entities. * * @param CartInterface $cart Cart * @param OrderInterface $order Order * * @return $this Self object */ public function loadOrderShippingMethod(CartInterface $cart, OrderInterface $order) { $shippingMethodId = $cart->getShippingMethod(); if (empty($shippingMethodId)) { return $this; } $shippingMethod = $this->shippingWrapper->getOneById($cart, $shippingMethodId); if ($shippingMethod instanceof ShippingMethod) { $order->setShippingAmount($shippingMethod->getPrice()); $order->setShippingMethod($shippingMethod); } }