I am looking for a way to get a products most child like category. For example if I have category1 -> category1.1 -> category1.1.1 I then need category1.1.1 Assuming I have a product that belongs to all three categories is there a specific way to call the most deeply rooted category. I know I can return all categories belonging to a product by doing this: echo $_product->getCategoryIds() But I need a programmatical way to know which is the deepest child.