From 9664a7dbe22d701086804493b166857b907540e2 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Fri, 3 May 2024 16:30:13 +0300 Subject: [PATCH] total paid fix --- src/Service/ShipmentService.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Service/ShipmentService.php b/src/Service/ShipmentService.php index ffe9dcc..fdcac7b 100644 --- a/src/Service/ShipmentService.php +++ b/src/Service/ShipmentService.php @@ -221,16 +221,14 @@ public function createShipmentFromOrder(Order $order) private function createNonDistributedShipment(Order $order, $idProduct, $isTestMode) { $products = $order->getProducts(); - $parcelPrice = 0; + $parcelPrice = $order->getTotalPaid(); $parcelWeight = 0; - $orderShippingCost = $order->total_shipping_tax_incl ?: 0; + foreach ($products as $product) { - $parcelPrice += $this->calculateProductsPrice($product); $parcelWeight += $product['weight'] * $product['product_quantity']; } $parcelPrice = $this->calculateParcelPriceWithOrderDiscount($order, $parcelPrice); - $parcelPrice += $orderShippingCost; $shipment = $this->createShipment($order, $idProduct, $isTestMode, 1, $parcelWeight, $parcelPrice); if (!$shipment->id) {