Show category images on shopping cart Woocommerce


I am running a woocommerce shop and I have products which are in multiple categories. I would like to show the category images on shopping cart

I only found how I can show the category image on the product category page:

if (is_product_category()){
global $wp_query;
// get the query object
$cat = $wp_query->get_queried_object();
// get the thumbnail id user the term_id
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', 
true );
// get the image URL
$image = wp_get_attachment_url( $thumbnail_id );
// print the IMG HTML
echo '<img src="'.$image.'" alt="" width="30" height="30" />';
, bouaziz mohamed laid 2 years 2019-12-29T06:30:45-05:00 0 Answers 96 views 0

Leave an answer