List All Attribute Values if In Specific Category

Question

the following list all possible values of an attribute in my Woo-commerce Store …

<ul>

    <?php $taxonomies = array('pa_diameter'); $args = array('hide_empty' => 0); $terms = get_terms( $taxonomies, $args); $empty_terms=array(); foreach( $terms as $term ){ echo '<li>' . $term->name . '</li>'; }; ?>

</ul>

However i only want to display the values if products that have them are also in a specific category, i.e. product_cat = ‘sample-cat’

Any ideas?

Thank you!

0
onesixty 2 months 0 Answers 10 views 0

Leave an answer