Example #1
0
 private function getShippingAdjustment(OrderInterface $order)
 {
     /** @var AdjustmentInterface $adjustment */
     foreach ($order->getAdjustments() as $adjustment) {
         if ($adjustment->getType() === \Sylius\Component\Core\Model\AdjustmentInterface::SHIPPING_ADJUSTMENT) {
             return $adjustment;
         }
     }
     $adjustment = $this->adjustmentFactory->createNew();
     $adjustment->setType(\Sylius\Component\Core\Model\AdjustmentInterface::SHIPPING_ADJUSTMENT);
     $order->addAdjustment($adjustment);
     return $adjustment;
 }