diff --git a/src/Core/Checkout/Cart/Delivery/DeliveryCalculatorDecorator.php b/src/Core/Checkout/Cart/Delivery/DeliveryCalculatorDecorator.php index 10213f5..f613603 100644 --- a/src/Core/Checkout/Cart/Delivery/DeliveryCalculatorDecorator.php +++ b/src/Core/Checkout/Cart/Delivery/DeliveryCalculatorDecorator.php @@ -230,6 +230,18 @@ private function calculateShippingCosts( $price = $this->getCurrencyPrice($priceCollection, $context); + if (!$calculatedLineItems->filter(static function($lineItem){ + if (!$lineItem->getDeliveryInformation()) { + return false; + } + if ($lineItem->getDeliveryInformation()->getFreeDelivery()) { + return false; + } + return true; + })->count()) { + $price = 0; + } + $cartExtension = $cart->getExtension(MyParcelDefaults::CART_EXTENSION_KEY); $myParcelData = $cartExtension ? $cartExtension->getVars() : []; diff --git a/src/Service/Config/ConfigGenerator.php b/src/Service/Config/ConfigGenerator.php index e6b0370..a26b21e 100644 --- a/src/Service/Config/ConfigGenerator.php +++ b/src/Service/Config/ConfigGenerator.php @@ -54,7 +54,7 @@ public function getCostForCarrierWithOptions(array $options, string $salesChanne $carrier = MyParcelCarriers::NPM_CARRIER_TO_CONFIG_CARRIER[$options['carrier']]; if (isset($options['packageType']) && AbstractConsignment::PACKAGE_TYPE_MAILBOX_NAME === $options['packageType'] && $this->isSettingEnabled($salesChannelId, 'priceMailbox', $carrier)) { - return $this->getConfigFloat($salesChannelId, 'priceMailbox', $carrier); + return min ($totalPrice, $this->getConfigFloat($salesChannelId, 'priceMailbox', $carrier)); } //Is it pickup?