Commerce: Product taxonomy filter

Component ID

2905578

Component name

Commerce: Product taxonomy filter

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

71

Component created

Component changed

Component body

This lightweight module is trying to solve the problem that Views contextual filter named "Content has taxonomy term ID (with depth)" is available only for nodes and can not be used for products in Drupal Commerce 2.x.

The Module extends Taxonomy module from Drupal core and provides a new contextual filter "Product has taxonomy term ID (with depth)".

Compared to the Taxonomy module that uses relationship table "taxonomy_index" between terms and nodes, this module uses only SQL query on existing tables. Module needs to know the name of your reference field. You must specify the field in the filter settings.

How to use

  1. Go to your product Views -> Advanced -> Contextual filters -> Add -> Product has taxonomy term ID (with depth)
  2. In Reference field: Enter a machine name of the field in the product type, which is referencing to a taxonomy

Module future

Drupal core should support this functionality in some future, so this module will be needless. Look at
Views should support - Entity: Has taxonomy term ID (with depth) - for entities for more information.