custom/plugins/WabsProductPreorder/src/Subscriber/SalesChannelProcessCriteriaSubscriber.php line 21

Open in your IDE?
  1. <?php
  2. namespace Wabs\ProductPreorder\Subscriber;
  3. use Shopware\Core\Content\Product\SalesChannel\ProductAvailableFilter;
  4. use Shopware\Core\System\SalesChannel\Event\SalesChannelProcessCriteriaEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class SalesChannelProcessCriteriaSubscriber implements EventSubscriberInterface
  7. {
  8.     const RECALCULATION_EXTENSION_NAME 'wabsPreorderRecalculation';
  9.     public static function getSubscribedEvents(): array
  10.     {
  11.         return [
  12.             'sales_channel.product.process.criteria' => 'removeFiltersForPreorderRecalculation'
  13.         ];
  14.     }
  15.     public function removeFiltersForPreorderRecalculation(SalesChannelProcessCriteriaEvent $event)
  16.     {
  17.         if (!$event->getContext()->hasExtension(self::RECALCULATION_EXTENSION_NAME)) {
  18.             return;
  19.         }
  20.         $event->getCriteria()->resetFilters();
  21.     }
  22. }