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

bojanz created an issue. See original summary.

mglaman’s picture

mglaman’s picture

I like the idea of returning NULL and allowing the invoker to decide the fallback variation.

bojanz’s picture

Assigned: Unassigned » bojanz

Going for the NULL option.

  • bojanz committed 6c18289 on 8.x-2.x
    Issue #2956043 by bojanz: ProductVariationAttributeMapper::...
bojanz’s picture

Status: Active » Fixed

Done.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.