Created
July 5, 2023 22:39
-
-
Save rickgregory/64cf3ce91b441d2a9ca4408b6e5554e8 to your computer and use it in GitHub Desktop.
Code to allow Breakdance Product List widget to show only product in the current category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$terms = get_the_terms( $post->ID, 'product_cat' ); | |
foreach ($terms as $term ) { | |
$product_cat_id = $term->term_id; | |
$product_cat_name = $term->name; | |
} | |
return ['post_type'=>'product','tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', | |
'field' => 'slug', | |
'terms' => $product_cat_name, | |
), | |
)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment