public function getMainVariationNumber(array $mainVariation, array $variations = [])
    {
        $found = false;

        $mainVariationNumber = (string) $mainVariation['id'];

        if ($this->configService->get('variation_number_field', 'number') === 'number') {
            $mainVariationNumber = (string) $mainVariation['number'];
        }

        foreach ($variations as $variation) {
            if ($variation->getNumber() === $mainVariationNumber) {
                $found = true;
                break;
            }
        }

        if ($found) {
            $checkActiveMainVariation = json_decode($this->configService->get('check_active_main_variation'));

            if (!$checkActiveMainVariation && !$mainVariation['isActive']) {
                foreach ($variations as $variation) {
                    if ($variation->getActive()) {
                        return $variation->getNumber();
                    }
                }
            }

            return $mainVariationNumber;
        }

        foreach ($variations as $variation) {
            if ($variation->getActive()) {
                return $variation->getNumber();
            }
        }

        return $mainVariationNumber;
    }
public function getMainVariationNumber(array $mainVariation, array $variations = [])
    {
        $found = false;

        $mainVariationNumber = (string) $mainVariation['id'];

        if ($this->configService->get('variation_number_field', 'number') === 'number') {
            $mainVariationNumber = (string) $mainVariation['number'];
        }

        foreach ($variations as $variation) {
            if ($variation->getNumber() === $mainVariationNumber) {
                $found = true;
                break;
            }
        }

        if ($found) {
            $checkActiveMainVariation = json_decode($this->configService->get('check_active_main_variation'));

            if (!$checkActiveMainVariation && !$mainVariation['isActive']) {
                foreach ($variations as $variation) {
                    if ($variation->getActive()) {
                        return $variation->getNumber();
                    }
                }
            }

            return $mainVariationNumber;
        }

        foreach ($variations as $variation) {
            if ($variation->getActive()) {
                return $variation->getNumber();
            }
        }

        return $mainVariationNumber;
    }
@param array $mainVariation
@param array $variations

@return string