custom/plugins/GrimmTheme/src/Storefront/Subscriber/OrderPaymentMethodChangedSubscriber.php line 18

Open in your IDE?
  1. <?php declare(strict_types 1);
  2. namespace GrimmTheme\Storefront\Subscriber;
  3. use Shopware\Core\Checkout\Order\Event\OrderPaymentMethodChangedCriteriaEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class OrderPaymentMethodChangedSubscriber implements EventSubscriberInterface
  6. {
  7.     public static function getSubscribedEvents(): array
  8.     {
  9.         return [
  10.             OrderPaymentMethodChangedCriteriaEvent::class => 'onPaymentMethodChanged'
  11.         ];
  12.     }
  13.     // SD-5184 - in order for the normal Bestellbestätigung to send here, add all info that is available with order.placed event
  14.     public function onPaymentMethodChanged(OrderPaymentMethodChangedCriteriaEvent $event)
  15.     {
  16.         $criteria $event->getCriteria();
  17.         $criteria
  18.             ->addAssociation('orderCustomer.customer')
  19.             ->addAssociation('orderCustomer.salutation')
  20.             ->addAssociation('deliveries.shippingMethod')
  21.             ->addAssociation('deliveries.shippingOrderAddress.country')
  22.             ->addAssociation('transactions.paymentMethod')
  23.             ->addAssociation('lineItems.cover')
  24.             ->addAssociation('currency')
  25.             ->addAssociation('addresses.country');
  26.     }
  27. }