Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Affected by promotion

Security covered Under active development 167 sites

This module provides a service to retrieve entities associated with a promotion. It allows developers to query for specific types of entities that a promotion applies to. This functionality can be integrated into offer type plugins by implementing a specific interface.

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

Drupal 8–11

Ask your assistant about Affected by promotion

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Sep 2023
Latest release
7 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
8.x-1.5 Stable 8–11 Mar 19, 2026
8.x-1.4 Stable 8–10 Sep 19, 2023