diff --git a/app/code/Magento/Shipping/Model/Rate/PackageResult.php b/app/code/Magento/Shipping/Model/Rate/PackageResult.php index 4fd4ce63a7e87..ec5582ba0b361 100644 --- a/app/code/Magento/Shipping/Model/Rate/PackageResult.php +++ b/app/code/Magento/Shipping/Model/Rate/PackageResult.php @@ -68,6 +68,7 @@ public function getAllRates() throw new \InvalidArgumentException('Same object received from carrier.'); } $rate->setPrice($rate->getPrice() + $currentRate->getPrice()); + $rate->setCost($rate->getCost() + $currentRate->getCost()); continue 2; } } diff --git a/app/code/Magento/Shipping/Model/Rate/Result.php b/app/code/Magento/Shipping/Model/Rate/Result.php index c4ba502b346e8..3a99b68f3754d 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result.php +++ b/app/code/Magento/Shipping/Model/Rate/Result.php @@ -163,6 +163,8 @@ public function asArray() 'title' => $rate->getMethodTitle(), 'price' => $rate->getPrice(), 'price_formatted' => $currencyFilter->filter($rate->getPrice()), + 'cost' => $rate->getCost(), + 'cost_formatted' => $currencyFilter->filter($rate->getCost()), ]; } return $rates; @@ -224,6 +226,7 @@ public function updateRatePrice($packageCount) if ($packageCount > 1) { foreach ($this->_rates as $rate) { $rate->setPrice($rate->getPrice() * $packageCount); + $rate->setCost($rate->getCost() * $packageCount); } }