WooCommerce – Display Category Image

woocommerce-display-category-image
Spread the love
// This will verify that this is a product category page
if (is_product_category()){
global $query;
// Getting the query object
$category = $query->get_queried_object();
// Geting the thumbnail id user the term_id
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true );
// Getting the image URL
$im = wp_get_attachment_url( $thumbnail_id );
// print the IMAGE HTML
echo '';
}

That’s it use it your code where you want to display .

Leave a Reply

Your email address will not be published. Required fields are marked *

WP Twitter Auto Publish Powered By : XYZScripts.com