custom/plugins/LoyxxSeminar/src/Subscriber/CartConvertedEventSubscriber.php line 20

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace LoyxxSeminar\Subscriber;
  3. use LoyxxSeminar\Core\Checkout\Cart\Participant\ParticipantTransformer;
  4. use Shopware\Core\Checkout\Cart\Order\CartConvertedEvent;
  5. use Shopware\Core\Framework\Event\BeforeSendResponseEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class CartConvertedEventSubscriber implements EventSubscriberInterface
  8. {
  9.     public static function getSubscribedEvents()
  10.     {
  11.         return [
  12.             CartConvertedEvent::class => 'convertParticipants'
  13.         ];
  14.     }
  15.     public function convertParticipants(CartConvertedEvent $event)
  16.     {
  17.         $cart $event->getCart();
  18.         $convertedCart $event->getConvertedCart();
  19.         $convertedCartWithParticipants ParticipantTransformer::transformParticipantInCart($cart$convertedCart);
  20.         $event->setConvertedCart($convertedCartWithParticipants);
  21.     }
  22. }