public function load(string
$productId, Request
$request, SalesChannelContext
$context): FindProductVariantRouteResponse
{ /** @var string|null $switchedGroup */
$switchedGroup =
$request->
get('switchedGroup'
);
/** @var array<string, string> $options */
$options =
$request->
get('options'
) ?
$request->
get('options',
[]) :
[];
$variantId =
$this->
searchForOptions($productId,
$context,
$options);
if ($variantId !== null
) { return new FindProductVariantRouteResponse(new FoundCombination($variantId,
$options));
} while (\
count($options) > 1
) { foreach ($options as $groupId =>
$_optionId) { if ($groupId !==
$switchedGroup) { unset($options[$groupId]);
break;
} }