Support promotions / discounts in when requesting a quote
Currently, you cannot request a quote as long as there is an active promotion in your cart.
-
Benjamin Hummel commented
Possible fix from customer:
The change we did in shopware terms is to first decorate the Shopware\Commercial\B2B\QuoteManagement\Domain\CartToQuote\QuoteRequestRoute class in the plugin and changed the request functionAdded code for removing the discount items from the cart before the validate function is called. So that there will be no validation error when creating a Quote which has discount items in the cart.
$cart = $this->cartService->getCart($context->getToken(), $context); if ($cart->getLineItems()->filterType(LineItem::PROMOTION_LINE_ITEM_TYPE)->count() > 0) { $discountItems = $cart->getLineItems()->filterType(LineItem::PROMOTION_LINE_ITEM_TYPE)->getElements(); $discountItemIds = array_map(function (LineItem $item) { return $item->getId(); }, $discountItems); $this->cartService->removeItems($cart, $discountItemIds, $context); } $this->validateCart($cart, $context->getContext());