Under Drupal, 9 I've set a Drupal Commerce site where the products can have different categories. For example, having a vocabulary like this:

Category A

  • Subcategory A1
  • Subcategory A2

Category B

  • Subcategory B1
  • Subcategory B2

Category C

A product can belong to the Subcategory A1 and Category C for example.

Categories of products

I need to create a view to create a catalogue showing the products belonging to every parent category, so there is an argument to filter the results by the parent, grouping the results by the taxonomy term.


The problem is that the results show terms whose parent is not the one in the filter.

For example if a product has the subcategory A1 and B1, for example, and I want to show products under the category A, the results are:


  • My product
  • Other product


  • My product

Another problem is that the parent term it's also shown. I could fix this filtering out the result whose parent is NULL, but if the category shown is Category C for example, there would not be results.

In the following example you can see the two problems:

enter image description here

Any ideas about how to exclude the subcategory B1 in this case and also solve the parent problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.