wordpresstaxonomywoocommerce

Get Woocommerce Category Thumbnails


I have a custom template for a woocommerce category page to only display the categories. I have got the system to get a list of the child categories (by using get_term_children($id, 'product_cat') and get_term_by(...)), but it only returns objects containing all the required information, except the thumbnail data. Does anyone know how I can get the thumbnail for the term?


Solution

  • Sorted it, here's the code I used:

    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    $image = wp_get_attachment_url( $thumbnail_id );