- Issue created by @luke.stewart
- 🇵🇭Philippines ambot112
C is a good approach.
However, other modules can subscribe the PRODUCT_DEFAULT_VARIATION event and do additional variation filtering.
- 🇮🇱Israel jsacksick
hm... The patch doesn't look correct, as you're not even looping on $enabled_variations... And btw the variable has a confusing name...
$this->getVariations()
returns all variations, regardless on whether they're enabled or not.Not sure yet whether we should proceed with that.
- 🇵🇭Philippines ambot112
Update the patch to use a function getFilteredVariations.
- Status changed to Needs work
11 days ago 2:23pm 11 February 2025 - 🇺🇦Ukraine lobodacyril
For me, it seems obvious to select the default variation from the filtered variation list (option C). In my case, I remove some variations from the list in some conditions, so if I remove the first variation, then it can't be the default. In the case of the current code, I can pull the default variation, which doesn't consist in the current user list. Of course, it's possible to redefine using ProductEvents::PRODUCT_DEFAULT_VARIATION but I'm expecting another result.
The patch looks fine to me but I can't apply it to drupal/commerce:2.40.0