Skip to content

Commit

Permalink
total paid fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GytisZum committed May 3, 2024
1 parent 8d90295 commit 9664a7d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Service/ShipmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9664a7d

Please sign in to comment.