Can I retrieve woocommerce product category name by ID?
Not thumbnail, not the URL, not the Sub-categories, just raw Category name.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityCan I retrieve woocommerce product category name by ID?
Not thumbnail, not the URL, not the Sub-categories, just raw Category name.
Use get_term_by
:
$id = 42;
if( $term = get_term_by( 'id', $id, 'product_cat' ) ){
echo $term->name;
}