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?
Leave a Reply
You must be logged in to post a comment.
Sorted it, here’s the code I used:
If the
get_woocommerce_term_meta()
function does not work for you then you can try theget_term_meta()
function instead.You can get the WooCommerce product category thumbnail with the following code-
Notice: get_woocommerce_term_meta is deprecated
Had a similar setup but when I used what you did I didnt actually get the thumbnail file I got the full image file so instead I used this: wp_get_attachment_thumb_url so that my output url would be “../my-images”/image-150×150.jpg” and actually got it to pull the thumbnail image, just incase anyone runs into a similar situation..
try this one