isMainVariant example

$result = [];
        foreach ($products as $listProduct) {
            $product = Product::createFromListProduct($listProduct);
            $number = $product->getNumber();
            $id = $product->getId();

            $product->setHasStock($product->getStock() >= $product->getUnit()->getMinPurchase());

            if ($variantFacet && $variantConfiguration) {
                $this->addVariantSearchDetails($product$configurations$variantFacet$variantConfiguration$combinations$listingPrices$availability);
            } elseif (!$product->isMainVariant()) {
                continue;
            } elseif (!$listProduct->isAvailable()) {
                $product->setHasAvailableVariant(false);
            }

            if (isset($average[$number])) {
                $product->setVoteAverage($average[$number]);
            }

            if (isset($calculated[$number])) {
                $product->setCalculatedPrices($calculated[$number]);
            }
Home | Imprint | This part of the site doesn't use cookies.