List All Attribute Values if In Specific Category


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


    <?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>'; }; ?>


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!

onesixty 2 months 0 Answers 10 views 0

Leave an answer