Problem/Motivation
ProductVariationAttributeMapper::selectVariation() calls getAttributeValueId() for every submitted attribute value on every variation. When a product has variations of more than one type, a variation that lacks one of the submitted attribute fields makes getAttributeValueId() throw InvalidArgumentException: Unknown attribute field name. This happens when the add-to-cart form is rebuilt (AJAX attribute change) or submitted.
Proposed resolution
As in #3635025, read each variation's attribute values once with getAttributeValueIds() and compare with $values[$field_name] ?? NULL, stopping at the first mismatch. A variation without an attribute is treated as not matching it.
Remaining tasks
- Kernel test for mixed variation types.
API changes
None.
Issue fork commerce-3635059
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
jsacksick commented