From 9f8b001436dd48072d160430fa65773d9ce5c075 Mon Sep 17 00:00:00 2001 From: m-muxfeld-diw <143803170+m-muxfeld-diw@users.noreply.github.com> Date: Thu, 8 Aug 2024 10:00:14 +0200 Subject: [PATCH] PISHPS-259: MollieLineItemBuilder now checks if the price definition is a AbsolutePriceDefinition and will set quantity to 1 if it is (#800) --- src/Service/MollieApi/Builder/MollieLineItemBuilder.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Service/MollieApi/Builder/MollieLineItemBuilder.php b/src/Service/MollieApi/Builder/MollieLineItemBuilder.php index 4a4e77126..cb8bfda6f 100644 --- a/src/Service/MollieApi/Builder/MollieLineItemBuilder.php +++ b/src/Service/MollieApi/Builder/MollieLineItemBuilder.php @@ -14,6 +14,7 @@ use Kiener\MolliePayments\Validator\IsOrderLineItemValid; use Mollie\Api\Types\OrderLineType; use Shopware\Core\Checkout\Cart\LineItem\LineItem; +use Shopware\Core\Checkout\Cart\Price\Struct\AbsolutePriceDefinition; use Shopware\Core\Checkout\Cart\Price\Struct\CalculatedPrice; use Shopware\Core\Checkout\Order\Aggregate\OrderDelivery\OrderDeliveryCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; @@ -146,6 +147,11 @@ public function buildLineItems(string $taxStatus, ?OrderLineItemCollection $line $this->orderLineItemValidator->validate($item); $extraData = $this->lineItemDataExtractor->extractExtraData($item); $itemPrice = $item->getPrice(); + $itemPriceDefinition = $item->getPriceDefinition(); + + if ($itemPriceDefinition instanceof AbsolutePriceDefinition) { + $item->setQuantity(1); + } if (!$itemPrice instanceof CalculatedPrice) { throw new MissingPriceLineItemException((string)$item->getProductId());