<?php
namespace Wabs\ProductPreorder\Subscriber;
use Shopware\Core\Content\Product\SalesChannel\ProductAvailableFilter;
use Shopware\Core\System\SalesChannel\Event\SalesChannelProcessCriteriaEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class SalesChannelProcessCriteriaSubscriber implements EventSubscriberInterface
{
const RECALCULATION_EXTENSION_NAME = 'wabsPreorderRecalculation';
public static function getSubscribedEvents(): array
{
return [
'sales_channel.product.process.criteria' => 'removeFiltersForPreorderRecalculation'
];
}
public function removeFiltersForPreorderRecalculation(SalesChannelProcessCriteriaEvent $event)
{
if (!$event->getContext()->hasExtension(self::RECALCULATION_EXTENSION_NAME)) {
return;
}
$event->getCriteria()->resetFilters();
}
}