I have a custom post type called 'products' the CPT has two custom taxonomies (both hierarchical); 1) 'product_type' and 2) 'product_provider'.
Each product will have both a 'product_type' and a 'product_provider' linked to it. On the archive page for each 'product_type' term I am outputting a filterable list of 'products', one of the filter options is by Provider which (obviously) filters based on the 'product_provider' custom tax.
The problem I have is outputting just the 'product_provider' terms that apply to the specific 'product_type'.
Product A. Product_type = 1, product_provider = W
Product B. Product_type = 1, product_provider = X
Product C. Product_type = 2, product_provider = Y
Product C. Product_type = 2, product_provider = W
On the archive page for 'product_type 1' using:
$terms = get_terms( array('taxonomy' => 'product_provider') );
Will output all terms within the 'product_provider' taxonomy - W, X, Y. I need to just output W and X - that is the 2 terms within 'product_provider' that apply to 'products' in the product_type custom tax.
I'm not sure if the answer is; a more robust term query, restructuring the CPT/taxonomies to remove the 'product_provider' - just make each provider a sub category of the specific 'product_type' (although this would lead to duplicating some providers as they offer products in multiple product_type's).