Skip to content

Commit

Permalink
fix(checkout): honor free shipping product setting (#77)
Browse files Browse the repository at this point in the history
INT-604
  • Loading branch information
joerivanveen authored Aug 5, 2024
1 parent 512e1bb commit 3997829
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Core/Checkout/Cart/Delivery/DeliveryCalculatorDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() : [];

Expand Down
2 changes: 1 addition & 1 deletion src/Service/Config/ConfigGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 3997829

Please sign in to comment.