12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Nov 5, 2021

Getting WooCommerce Product Categories of a specified parent term in WordPress

Sridhar Katakam

In the WPDevDesign Facebook group a user asks:

...
and wanted to loop through and always show in the footer: All WooCommerce Category Images of all the Sub Categories of a certain Top Category and have each category image, link to its category.
...

This members-only tutorial provides the code for getting the child product categories of a specified term of product_cat taxonomy added by WooCommerce, looping through them and outputting the category images linked to their term archive pages in a grid.

For example, given these product categories

we specify the ID of Clothing product category in the code and get these on the front end:

Step 1

If using Oxygen, edit a Template/Page with Oxygen, add a Section and inside that, a Code Block.

Set its width to 100%.

PHP & HTML:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right