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
- Project categories: E-commerce
- Ecosystem: Commerce Core
38 sites report using this module
- Created by eiriksm on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
8.x-1.5
released 19 March 2026
Works with Drupal: ^8.7.7 || ^9 || ^10 || ^11
Allow D11
Install:
Development version: 8.x-1.x-dev updated 19 Mar 2026 at 11:23 UTC

