This is a bug from before the refactor.
ProductVariationAttributeMapper::selectVariation says:
* If no match could be made, the default variation is selected instead.
But that's not true, the code has no access to $product->getDefaultVariation(), it does this:
$selected_variation = reset($variations);
Now, the two lines are currently identical, but once we add the ability to dynamically alter the default variation, they won't be.
selectVariation() needs to either be passed the default variation, or it needs to return NULL instead of the first variation, telling the caller to take the default variation there.
Comments
Comment #2
mglamanComment #3
mglamanI like the idea of returning NULL and allowing the invoker to decide the fallback variation.
Comment #4
bojanz commentedGoing for the NULL option.
Comment #6
bojanz commentedDone.