WooCommerce - excelling eCommerce
Category images not showing in product category widget (8 posts)

  1. Jon Henwood
    Posted 2 years ago #


    How do I add the product category image to the woocommerce products category sidebar widget. Please let me know the php and the line it needs to go on.



  2. invaderB
    Posted 2 years ago #

    I'm curious on this as well, if anyone could shed some light?

  3. morgsta
    Posted 2 years ago #

    I can't get any images to show on category widget or category product page. The Categories are set up with a thumbnail but nothing appears

  4. paulmp
    Posted 2 years ago #

    I'd really like a resolution for this as well. I can't get them to show up in the widget.

  5. owlonline
    Posted 2 years ago #

    I'd like to see this functionality as well. Any clues?

  6. documentninja
    Posted 2 years ago #

    I am trying to figure this out too. Can anyone help??

  7. edmacfly
    Posted 1 year ago #

    Sorry to revive an oldish thread, but has anyone managed to solve this? Is there a plugin that would do this job? TIA

  8. danielbaker
    Posted 1 year ago #

    I have found a way to solve this issue - though it means editing a core file. I am hoping to create a hook/filter to do the same soon.

    Basically look for:

    Then on line 62:

    function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
    	    $thumbnail_id = get_woocommerce_term_meta( $object->term_id, 'thumbnail_id', true ); // get category thumbnail id
    	    $image = wp_get_attachment_url( $thumbnail_id ); // get image and convert to var
    		$output .= '<li class="cat-item cat-item-' . $object->term_id;
    		if ( $args['current_category'] == $object->term_id )
    			$output .= ' current-cat';
    		if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $object->term_id, $args['current_category_ancestors'] ) )
    			$output .= ' current-cat-parent';
    		$output .=  '"><a href="' . get_term_link( (int) $object->term_id, 'product_cat' ) . '">' . __( $object->name, 'woocommerce' ) . '<img src="' . $image . '" alt="" /></a>'; // insert category image into link
    		if ( $args['show_count'] )
    			$output .= ' <span class="count">(' . $object->count . ')</span>';

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic