From 0c4bb32fe525f040b6e720e32652fc9966ec0086 Mon Sep 17 00:00:00 2001 From: Luca Scalzotto Date: Tue, 17 Oct 2023 21:13:56 +0200 Subject: [PATCH] Remove unused freeBoxes logic --- Model/Carrier/Parcelpro.php | 40 ------------------------------------- 1 file changed, 40 deletions(-) diff --git a/Model/Carrier/Parcelpro.php b/Model/Carrier/Parcelpro.php index d87cf81..09e6fca 100644 --- a/Model/Carrier/Parcelpro.php +++ b/Model/Carrier/Parcelpro.php @@ -121,8 +121,6 @@ public function collectRates(RateRequest $request) $object = $objectManager->create('\Magento\Sales\Model\AdminOrder\Create'); $total = $object->getQuote()->getSubtotal(); $grandTotal = $object->getQuote()->getGrandTotal(); - - $freeBoxes = $this->getFreeBoxesCount($request); } else { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $total = $objectManager->create('\Magento\Checkout\Model\Session') @@ -216,42 +214,4 @@ public function collectRates(RateRequest $request) } return $result; } - - /** - * @param RateRequest $request - * @return int - */ - private function getFreeBoxesCount(RateRequest $request) - { - $freeBoxes = 0; - if ($request->getAllItems()) { - foreach ($request->getAllItems() as $item) { - if ($item->getProduct()->isVirtual() || $item->getParentItem()) { - continue; - } - - if ($item->getHasChildren() && $item->isShipSeparately()) { - $freeBoxes += $this->getFreeBoxesCountFromChildren($item); - } elseif ($item->getFreeShipping()) { - $freeBoxes += $item->getQty(); - } - } - } - return $freeBoxes; - } - - /** - * @param mixed $item - * @return mixed - */ - private function getFreeBoxesCountFromChildren($item) - { - $freeBoxes = 0; - foreach ($item->getChildren() as $child) { - if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) { - $freeBoxes += $item->getQty() * $child->getQty(); - } - } - return $freeBoxes; - } }