getOrderPositionByProduct example



    /** * @return ProductVariant[] */
    private function getOutOfStockProducts(Order $order): array
    {
        $products = $this->getProductsOfOrder($order);

        $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;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.