custom/plugins/fourtwosixProductShippingPrice/src/Subscriber/CartBeforeSerialization.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace fourtwosix\ProductShippingPrice\Subscriber;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Shopware\Core\Checkout\Cart\Event\CartBeforeSerializationEvent;
  6. class CartBeforeSerialization implements EventSubscriberInterface
  7. {
  8.     public static function getSubscribedEvents(): array
  9.     {
  10.         return [
  11.             CartBeforeSerializationEvent::class => 'onCartBeforeSerialization'
  12.         ];
  13.     }
  14.     public function onCartBeforeSerialization(CartBeforeSerializationEvent $event): void
  15.     {  
  16.         $allowed $event->getCustomFieldAllowList();
  17.         $allowed[] = 'shipping_price';
  18.         $allowed[] =  'shipping_price_deactivate';
  19.         
  20.         $event->setCustomFieldAllowList($allowed);
  21.     }
  22. }