<?php
declare(strict_types=1);
namespace fourtwosix\ProductShippingPrice\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Checkout\Cart\Event\CartBeforeSerializationEvent;
class CartBeforeSerialization implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
CartBeforeSerializationEvent::class => 'onCartBeforeSerialization'
];
}
public function onCartBeforeSerialization(CartBeforeSerializationEvent $event): void
{
$allowed = $event->getCustomFieldAllowList();
$allowed[] = 'shipping_price';
$allowed[] = 'shipping_price_deactivate';
$event->setCustomFieldAllowList($allowed);
}
}