|

How to get the parent product category ID, Name, etc in specific product?

How to get the parent product category ID, Name, etc in specific product? Just copy and paste the codes below.

$object = get_queried_object();
$product_cat = get_the_terms( $object->ID, 'product_cat' );
echo $product_cat[0]->name;
echo wpautop( $product_cat[0]->description );

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *