<?php declare(strict_types=1);
namespace Swag\BasicExample\Subscriber;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Content\Product\ProductEvents;
class MySubscriber implements EventSubscriberInterface
public static function getSubscribedEvents(): array
ProductEvents::PRODUCT_LOADED_EVENT => 'onProductsLoaded'
public function onProductsLoaded(EntityLoadedEvent $event): void
// Do stuff with the product