private function checkStockNotEmpty()
    {
        $cart = $this->getSession()->getSessionCart($this->getDispatcher());

        $cartItems = $cart->getCartItems();

        foreach ($cartItems as $cartItem) {
            $pse = $cartItem->getProductSaleElements();

            $product = $cartItem->getProduct();

            if ($pse->getQuantity() <= 0 && $product->getVirtual() !== 1) {
                return $this->generateRedirectFromRoute('cart.view');
            }
        }

        return null;
    }
private function checkStockNotEmpty()
    {
        $cart = $this->getSession()->getSessionCart($this->getDispatcher());

        $cartItems = $cart->getCartItems();

        foreach ($cartItems as $cartItem) {
            $pse = $cartItem->getProductSaleElements();

            $product = $cartItem->getProduct();

            if ($pse->getQuantity() <= 0 && $product->getVirtual() !== 1) {
                return $this->generateRedirectFromRoute('cart.view');
            }
        }

        return null;
    }
private function checkStockNotEmpty ( ) { $ cart = $ this -> getSession ( ) -> getSessionCart ( $ this -> getDispatcher ( ) ) ; $ cartItems = $ cart -> getCartItems ( ) ; foreach ( $ cartItems as $ cartItem ) { $ pse = $ cartItem -> getProductSaleElements ( ) ; $ product = $ cartItem -> getProduct ( ) ; if ( $ pse -> getQuantity ( ) <= 0 && $ product -> getVirtual ( ) !== 1 ) { return $ this -> generateRedirectFromRoute ( 'cart.view' ) ; } } return null ; }
Redirect to cart view if at least one non product is out of stock

@return null|BaseResponse
Redirect to cart view if at least one non product is out of stock