[SOLVED] Get Category Of Product WooCommerce


This Content is from Stack Overflow. Question asked by Nethsara Siyum

When I try to get the category of an item, it shows like this

enter image description here

The code I am using is $product->get_categories()

I need to get output ‘Hoodies’

Thanks for your time.


Try this:

$categories = $product->get_categories();
echo strip_tags($categories);

This Question was asked in StackOverflow by nethsrk and Answered by laka9 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?