In Progress

Need code to get woocommerce top level parent category title

Im using a custom theme and creating a custom template for woocommerce categories and single product pages.

Im trying to figure out the code to show the top level parent category title on sub category pages. In my design I need to show the current category being viewed and the top parent category title.

If Im viewing Category 1 > sub cat 1 > sub cat 2 then I would like to display two titles on this category page - Category 1 and sub cat 2

If Im viewing a product inside sub cat 2, I want to still see the current category (sub cat 2) and the top level parent (Category 1).

If you look at the image attached you will see that basically the bread crumb it spit up into three titles on my page.

I just need the snippet of code that I can place in my theme to show the top level parent category title on my category and single product pages. It should only show the top level title even if there are multiple sub parents such as cat 1 > cat 2 > cat 3 > cat 4 ---- when viewing cat 4 I will see cat 1 and cat 4 titles.

You will need to know how to do this, Ive spent a week in the forums with no success but I know it can be done because its easy to do with normal wordpress categories.

Skills: PHP, WordPress

See more: woocommerce category title, woocommerce display parent categories, woocommerce parent category, woocommerce category parent, single parent title wordpress, parent category woocommerce, woocommerce parent title, wordpress woocommerce parent product category, display woocommerce category, level two, how to get a product design, how to design a top, code get, code forums, woocommerce theme, woocommerce template, woocommerce product page, woocommerce php, woocommerce c++, parent, custom woocommerce, creating a custom wordpress theme, woocommerce custom, code snippet wordpress, design woocommerce product

About the Employer:
( 3 reviews ) Arnold, United States

Project ID: #4919608

Awarded to:


Hello, Greetings!! Had a look at your project post and we are well suited for this Job as wordpress is our core work domain which is backed by our strong portfolio and feedback of the clients. Look forward to More

$34 USD in 0 days
(86 Reviews)

4 freelancers are bidding on average $39 for this job


Hello, we are ready to provide solution to your WooCommerce category/sub category listing as per requirement. Regards, Evina.

$61 USD in 2 days
(59 Reviews)

Dear sir, I'm ready to start working and i will complete on today

$30 USD in 1 day
(28 Reviews)

Hello developdesign, I have read your requirements, I'm a Wordpress/Woocommerce Expert and I am very confident to do this project. I guarantee COMPLETE satisfaction before payment. Please check PM for more details!

$36 USD in 1 day
(22 Reviews)

Hi, I can do this for you, please check PM for more details. Feel free to contact me if you need any more info.

$30 USD in 3 days
(0 Reviews)