getStockItemConfiguration = $getStockItemConfiguration; $this->stockConfiguration = $stockConfiguration; } /** * @param AppendReservationsInterface $subject * @param \Closure $proceed * @param ReservationInterface[] $reservations * * @throws LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundExecute(AppendReservationsInterface $subject, \Closure $proceed, array $reservations) { if (!$this->stockConfiguration->canSubtractQty()) { return; } $reservationToAppend = []; foreach ($reservations as $reservation) { $stockItemConfiguration = $this->getStockItemConfiguration->execute( $reservation->getSku(), $reservation->getStockId() ); if ($stockItemConfiguration->isManageStock()) { $reservationToAppend[] = $reservation; } } if (!empty($reservationToAppend)) { $proceed($reservationToAppend); } } }