Provides a service to give you the entities that are affected by a promotion.

If your offer type supports it, you can do stuff like this:

/** @var \Drupal\affected_by_promotion\AffectedEntitiesManager $mng */
$mng = \Drupal::service('affected_by_promotion.affected_entities_manager');
/** @var \Drupal\Core\Database\Query\SelectInterface $q */
$q = $mng->getAffectedEntitiesQuery($promotion, 'commerce_product');
$products = $q->execute();

For your offer type plugin to support it, it has to implement the following interface:

\Drupal\affected_by_promotion\SupportsAffectedEntitiesQueryInterface

Which has the following method:

public function getAffectedEntitiesQuery($entity_type_id);

There is also an issue to get this into commerce: https://www.drupal.org/project/commerce/issues/3007070

Supporting organizations: 
Development and maintenance

Project information

Releases