From f64281102c6c16b0e67d779d178054f179044187 Mon Sep 17 00:00:00 2001 From: Alexander Menk Date: Wed, 25 Oct 2017 13:33:13 +0200 Subject: [PATCH] Fix Notice: freePackageValue is undefined As visible from the code, freePackageValue can be undefined in some cases but accessed. `$request->getAllItems() == false` and `$request->getPackageQty() == $freeQty` is true and `!empty($rate) && $rate['price'] >= 0` is false This fixes this --- app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index b12691ad16245..87d4b984cf933 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -113,8 +113,9 @@ public function collectRates(RateRequest $request) // Free shipping by qty $freeQty = 0; + $freePackageValue = 0; + if ($request->getAllItems()) { - $freePackageValue = 0; foreach ($request->getAllItems() as $item) { if ($item->getProduct()->isVirtual() || $item->getParentItem()) { continue;