$product =
$this->productService->
get($productNumber,
$context);
if (!
$product) { return [];
} if ($this->config->
get('hideNoInStock'
) && !
$product->
isAvailable()) { return [];
} if ($product->
hasConfigurator()) { $type =
$this->
getConfiguratorType($product->
getId());
/**
* Check if a variant should be loaded. And load the configuration for the variant for pre selection.
*
* Requires the following scenario:
* 1. $number has to be set (without a number we can't load a configuration)
* 2. $number is equals to $productNumber (if the order number is invalid or inactive fallback to main variant)
* 3. $configuration is empty (Customer hasn't not set an own configuration)
*/
if ($providedNumber &&
$providedNumber ==
$productNumber &&
empty($selection) ||
$type === 0
) { $selection =
$product->
getSelectedOptions();
}