Show number of active product variations for a display node
I need my lists of products and my product display for a clothing shop show the message "Available in X colors" for each products. Each color corresponds to a product variation. I thought I had it. I'm using a view with a contextual filter for Node ID that counts the number of product variation for a given display. I'm inserting it into the display node using module Viewfield.
However, I've realized that this is not fully correct. When some of the product variations for a product display are disabled, the "Available in X colors" display does not filter out the disabled colors. I'm trying to modify my view so that these are filtered out but I can't find out how to use the product variation state as a filtering criterium. Using a relationship on Product doesn't seem to work because the Product field is multi-valued and
the relationship will only take the first product variation in the list.
This doesn't seem to be an unusual feature. Has anyone done this before?
Thanks in advance for your help!