protected function recalculateShippingTotal(OrderInterface $order) { $grossAmount = $order->getShippingTotal()->getGrossAmount(); $taxRate = $order->getShippingMethod()->getTax()->getValue(); $currency = $order->getCurrency(); $orderTotal = $this->orderTotalFactory->createFromSpecifiedValues($grossAmount, $taxRate, $currency); $order->setShippingTotal($orderTotal); }
protected function prepareOrderShippingDetails(CartInterface $cart, OrderInterface $order) { $cost = $cart->getShippingMethodCost()->getCost(); $grossAmount = $this->getCurrencyHelper()->convert($cost->getGrossAmount(), $cost->getCurrency(), $order->getCurrency()); $taxRate = $cost->getTaxRate(); $orderTotal = $this->orderTotalFactory->createFromSpecifiedValues($grossAmount, $taxRate, $order->getCurrency()); $order->setShippingTotal($orderTotal); }
/** * Prepares order shipping details * * @param OrderInterface $order * @param ShippingMethodCostInterface $shippingMethodCost */ protected function prepareShippingTotals(OrderInterface $order, ShippingMethodCostInterface $shippingMethodCost) { $cost = $shippingMethodCost->getCost(); $baseCurrency = $cost->getCurrency(); $shippingTotal = new OrderTotal(); $shippingTotal->setGrossAmount($this->currencyHelper->convert($cost->getGrossAmount(), $baseCurrency, $order->getCurrency())); $shippingTotal->setNetAmount($this->currencyHelper->convert($cost->getNetAmount(), $baseCurrency, $order->getCurrency())); $shippingTotal->setTaxAmount($this->currencyHelper->convert($cost->getTaxAmount(), $baseCurrency, $order->getCurrency())); $shippingTotal->setTaxRate($this->currencyHelper->convert($cost->getTaxRate())); $shippingTotal->setCurrency($order->getCurrency()); $order->setShippingTotal($shippingTotal); }