Add support for commerce_entity_bundle filter plugin

Created on 24 September 2025, 17 days ago
Updated 27 September 2025, 14 days ago

Problem/Motivation

The views_filters_summary module does not correctly display the summary for exposed filters when using a Product type filter (which is an entity bundle) from the Drupal Commerce module.

This happens because the filter plugin used by Commerce for its entity bundles is commerce_entity_bundle, but this plugin ID is not handled in the switch statement within the buildFilterDefinition() method in ViewsFiltersSummary.php. The current code only accounts for the generic bundle case, causing Commerce product type filters to be ignored.

Steps to reproduce

  1. Install a Drupal site with the Commerce and views_filters_summary modules.
  2. Create at least one Commerce Product type (e.g., "T-shirt").
  3. Create several products assigned to that product type.
  4. Create a new View that displays Commerce Products.
  5. Add an exposed filter for the Product type. This filter uses the commerce_entity_bundle plugin.
  6. In the View's header or footer, add a Views Filters Summary area and configure it to display the summary.
  7. Go to the View's page and select a product type from the exposed filter.
  8. Expected result: The summary area should display the selected product type (e.g., "for T-shirt").
  9. Current result: The summary for the selected product type does not appear.

Proposed resolution

The solution is to add a new case to handle the commerce_entity_bundle plugin ID alongside the existing bundle case in the buildFilterDefinition() method.

File: src/Plugin/views/area/ViewsFiltersSummary.php

Before

// Around line 688
case 'bundle':
if (is_array($original_value)) {

After (with the proposed fix)

// Around line 688
case 'commerce_entity_bundle':
case 'bundle':
if (is_array($original_value)) {

This simple addition makes the module compatible with Commerce's entity bundle filters without affecting existing functionality.

Remaining tasks

  • Create a Merge Request with the proposed fix.
  • Review the Merge Request.
  • Commit the changes.
Feature request
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇪🇸Spain cgalibar Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024