Ștefan Roman
Ștefan Roman

Reputation: 1

Drupal 8 views entity reference exposed filter based on node reference

I have a problem in filtering a views with an entity referenced field.

I have a content type called "product" and a content type called "category". In "product" node i have an entity reference field to "category" nodes (only one category per product).

I have a views page which is displaying products, and a filter by category (category field from product content type), but i can't filter products with the same category value.

I tried Views Reference Filter module, but i got an unexpected error.

Question: How can i filter my views with category? Thank You!

Upvotes: 0

Views: 1922

Answers (1)

Yassine ECHCHARAFI
Yassine ECHCHARAFI

Reputation: 660

  • Create a view listing Content of type Product.
  • Click on add in RELATIONSHIPS section.
  • Search for Referenced Entity via your field in Product (for example field_category).
  • Require this relationship.
  • In FILTER CRITERIA add any field you want in the referenced entity(Category).

N.B: if you want to expose this filter to users check Expose this filter to visitors, to allow them to change it.

Upvotes: 0

Related Questions