Last active
August 19, 2016 04:59
-
-
Save kirandash/010265fcf403be55936218306a27f937 to your computer and use it in GitHub Desktop.
A WC product may belong to none, one or more WC categories. Supposing you just want to get one WC category id.
This file contains hidden or 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
global $post; | |
$terms = get_the_terms( $post->ID, 'product_cat' ); | |
foreach ($terms as $term) { | |
$product_cat_id = $term->term_id; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment