public function __construct( private readonly QuantityPriceCalculator
$priceCalculator,
private readonly PercentageTaxRuleBuilder
$percentageTaxRuleBuilder ) { } public function calculate(CartDataCollection
$data, Cart
$cart, DeliveryCollection
$deliveries, SalesChannelContext
$context): void
{ foreach ($deliveries as $delivery) { $this->
calculateDelivery($data,
$cart,
$delivery,
$context);
} } private function calculateDelivery(CartDataCollection
$data, Cart
$cart, Delivery
$delivery, SalesChannelContext
$context): void
{ $costs = null;
$manualShippingCost =
$cart->
getExtension(DeliveryProcessor::MANUAL_SHIPPING_COSTS
);
$manualShippingCost =
$manualShippingCost instanceof CalculatedPrice ?
$manualShippingCost : null;
if ($delivery->
getShippingCosts()->
getUnitPrice() > 0 ||
$manualShippingCost) { $costs =
$this->
calculateShippingCosts( $delivery->
getShippingMethod(),