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; - } }