• The code on taxonomy-product_cat.php (below) is not displaying the product category thumbnail. Side note: I added a new size “brand_thumbnail” to my theme, but it wasn’t working prior to using “shop_thumbnail” or “shop_category”.

    <?php $term = get_term_by( 'slug', get_query_var($wp_query->query_vars['taxonomy']), $wp_query->query_vars['taxonomy']); ?>
    
    <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'brand_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="310px" height="265px" />'; ?>

    Is there something wrong with my post_thumbnail ($loop…….)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I also face this problem, and now not yet solve

    I’ve also been having problems with this.

    I ended up using this for now (which works) but i’m looking into alt method.

    global $wp_query;
    $cat = $wp_query->get_queried_object();
    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    $image = wp_get_attachment_url( $thumbnail_id );
    echo '<img src="' . $image . '" width="200px" height="200px" />';

    To avoid Safari showing an empty box at the size of the thumbnail when there is no thumbnail, do this isnstead:

    global $wp_query;
    $cat = $wp_query->get_queried_object();
    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
    $image = wp_get_attachment_url( $thumbnail_id );
    echo wp_get_attachment_image( $thumbnail_id );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WooCommerce] Product Category Thumbnail not displaying’ is closed to new replies.