getWithoutDeliveryFree example

private function matches(Delivery $delivery, ShippingMethodPriceEntity $shippingMethodPrice, SalesChannelContext $context): bool
    {
        if ($shippingMethodPrice->getCalculationRuleId()) {
            return \in_array($shippingMethodPrice->getCalculationRuleId()$context->getRuleIds(), true);
        }

        $start = $shippingMethodPrice->getQuantityStart();
        $end = $shippingMethodPrice->getQuantityEnd();

        $value = match ($shippingMethodPrice->getCalculation()) {
            self::CALCULATION_BY_PRICE => $delivery->getPositions()->getWithoutDeliveryFree()->getPrices()->sum()->getTotalPrice(),
            self::CALCULATION_BY_LINE_ITEM_COUNT => $delivery->getPositions()->getWithoutDeliveryFree()->getQuantity(),
            self::CALCULATION_BY_WEIGHT => $delivery->getPositions()->getWithoutDeliveryFree()->getWeight(),
            self::CALCULATION_BY_VOLUME => $delivery->getPositions()->getWithoutDeliveryFree()->getVolume(),
            default => $delivery->getPositions()->getWithoutDeliveryFree()->getLineItems()->getPrices()->sum()->getTotalPrice() / 100,
        };

        // $end (optional) exclusive         return (!$start || FloatComparator::greaterThanOrEquals($value$start)) && (!$end || FloatComparator::lessThanOrEquals($value$end));
    }

    private function calculateShippingCosts(ShippingMethodEntity $shippingMethod, PriceCollection $priceCollection, LineItemCollection $calculatedLineItems, SalesChannelContext $context, ?CalculatedPrice $manualShippingCost = null): CalculatedPrice
    {
static::assertNotNull($price);
        $deliveryPositionCollection->add(
            new DeliveryPosition(
                Uuid::randomHex(),
                $lineItem2,
                $lineItem2->getQuantity(),
                $price,
                new DeliveryDate(new \DateTimeImmutable('2020-01-01')new \DateTimeImmutable('2020-01-01')),
            )
        );

        static::assertEquals(80, $deliveryPositionCollection->getWithoutDeliveryFree()->getWeight());
    }

    /** * @dataProvider volumeDataProvider */
    public function testCalculateVolumeWithMultipleLineItemsWithMultipleQuantities(
        ?float $height,
        ?float $width,
        ?float $length,
        float $expect
    ): void {
        
Home | Imprint | This part of the site doesn't use cookies.