Install

Works with Drupal: ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 48.89 KB
MD5: eb76def1d202c2b09a7c3ba149551c06
SHA-1: a143ee3fd259128930250ab4811433047150c8dd
SHA-256: 7815c4c6c0875c483f9a8b389bef53a4fd4dfb80a77e6cefcf6aa16b516721ba
Download zip 84.88 KB
MD5: ef45345f820993a4bdd8f022f4eef097
SHA-1: 1e8c062ac95b93d37913ecdf4580fe854414c190
SHA-256: 082262569b22e6445335d759a92c423682a9474013e66c8177eb4828d40e0c8b

Release notes

First release of the 2.x branch: Drupal 11 and Commerce 3 only. Drupal 10 and Commerce 2 stay on 1.0.x.

Upgrading from 1.0.x

  1. composer require drupal/commerce_promo_bar:^2.0
  2. drush updb: adds the country fields (update 10002) and moves the promotion field to the new promotion widget.
  3. Make sure cron runs. It clears cached promo bars when one starts, ends or its countdown finishes, for caches that ignore max-age (anonymous page cache, reverse proxies).

Breaking changes

  • Requires Drupal ^11 and Commerce ^3. The Address module is now a dependency.
  • PromoBar::evaluateVisibility() is removed. Use the commerce_promo_bar.visibility service: isVisible($promo_bar, $path).
  • PromoBarStorageInterface has two new methods, loadVisible() and loadNextScheduled(). Custom storage classes must implement them.
  • The promotion field uses the new "Existing or new promotion" widget instead of Inline Entity Form. The update moves existing form displays over.

New

  • #3455406: Restrict promo bars by country, shown or hidden for the listed countries. The country is the one Commerce resolves for the request.
  • #3631082: Resolve visible promo bars outside the block, for API resources and other front ends:
    • PromoBarStorageInterface::loadVisible($store, $account, $path, $cacheability);
    • the commerce_promo_bar.visibility and commerce_promo_bar.body_processor services;
    • FilterPromoBarsEvent now provides the path, the customer and the cacheability (getPath(), getAccount(), getCacheability()).
  • New submodule, Commerce Promo Bar JSON:API (needs JSON:API Resources): GET /jsonapi/promo-bars?pagePath=/blog returns the promo bars visible on a page, message ready to output. Other modules can add attributes by decorating the resource service.

Fixed

  • #3631080: The promo bar block cache ignored customer roles and start/end dates. It now varies by store, roles, country and path, and expires at the next scheduled change.

Other

  • Tests use PHPUnit attributes, and the CI no longer runs against the previous major.
Created by: valic
Created on: 13 Nov 2026 at 15:19 UTC
Last updated: 13 Nov 2026 at 15:21 UTC
Bug fixes
New features

Other releases