isValidStock example

$invalid = [];
        foreach ($products as $product) {
            $position = $this->getOrderPositionByProduct($product$order);

            if (!$position) {
                continue;
            }

            $newStock = $product->getInStock() - $position->getQuantity();

            if (!$this->isValidStock($product$newStock)) {
                $invalid[] = $product;
            }
        }

        return $invalid;
    }

    private function getOrderPositionByProduct(ProductVariant $variant, Order $order): ?Detail
    {
        foreach ($order->getDetails() as $detail) {
            if (!$this->isProductPosition($detail)) {
                
Home | Imprint | This part of the site doesn't use cookies.