Get Woocommerce Category Thumbnails
<?php
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image_url = wp_get_attachment_url( $thumbnail_id ); // This variable is returing the product category thumbnail image URL.
Notice: get_woocommerce_term_meta is deprecated
If the get_woocommerce_term_meta()
function does not work for you then you can try the get_term_meta()
function instead.
You can get the WooCommerce product category thumbnail with the following code-
<?php
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image_url = wp_get_attachment_url( $thumbnail_id ); // This variable is returing the product category thumbnail image URL.
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 );