displaying category image in woocommerce

/* displaying category images */
 $all_categories = get_categories('taxonomy=product_cat&hide_empty=0&hierarchical=1');
 foreach ($all_categories as $cat) {
 $category = $cat->term_id; // retreives the currently queried object
 $category_thumbnail = get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true);
 $image = wp_get_attachment_url($category_thumbnail);
 echo '<a href="'.get_term_link($cat->slug, 'product_cat').'"><img src="'.$image.'" width="350" height="150"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s