Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Followup to #2506163: Complete the initial product architecture.
For the add to cart form we need a way to get all enabled variations of a product.
This means getting the variation ids referenced by the product, loading only the enabled ones (status = TRUE), then running an event on them (COMMERCE_PRODUCT.FILTER_VARIATIONS) to get the final list.
This should be implemented in a VariationManager (using the variation storage and the entity dispatcher as dependencies), with a getEnabledVariations($product) method. This will allow the logic to be easily swappable.
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commented