Problem/Motivation

It is possible to add a taxonomy term linked to a product (or variation) as an entityreference filter for product type (or variation type), but it seems that the same behaviour is not possible with product attributes used in the variations.

Steps to reproduce

Create a views of variations
Add the Relationships: Product variation using attribute_ your attribute
Try to add your attribute as filter: it does not appear in the list as entityreference filter

Proposed resolution

I made the following merge request

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kimlop created an issue. See original summary.

kimlop’s picture

Issue summary: View changes
kimlop’s picture

Assigned: Unassigned » kimlop
Status: Active » Needs review
maximkashuba’s picture

Thank you for the report and the MR @kimlop — much appreciated.

This issue is dupliate of #3514068 and #3545960

That whole hardcoded chain (nid/uid/tid/gid + commerce) is gone as of 2.0.0-beta6,
and it turns out it was the cause here too: the old elseif (mb_strpos($table_name, 'commerce_product') !== FALSE) branch
swallowed the attribute field tables, so the generic entity reference branch was never reached.
The hook now uses the Entity API (EntityTypeManager::getDefinitions()) to map every content
entity type's base/data table and ID key, resolves entity reference fields from the field storage config's target_type.

Verified on Drupal 10.3 with Commerce 3.3.6: with an attribute attached to a variation type.

Marking as Closed (duplicate).
Closing MR !23 as no longer applicable — please reopen if you still hit this on 2.0.x-dev.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.