Show Product category list in Woocommerce WordPress Plugin without thumbnails

I am using the following short code to list the product categories in woocommerce WordPress plugin

<?php echo do_shortcode('[product_categories number=""]'); ?>

The problem is the category thumbnail that I need to get rid of. I want to hide it and doing it with CSS seems to be a big hassle. Is there anyway I can list the categories without the thumbnails appearing?

Related posts

Leave a Reply

2 comments

  1. You could use the following:

    $args = array( 'taxonomy' => 'product_cat' );
    $terms = get_terms('product_cat', $args);
    
    if (count($terms) > 0) {
        echo '<p class="my_term-archive">';
        foreach ($terms as $term) {
            echo '<a href="/term-base/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a>';    
        }
        echo '</p>';
    }
    
  2. Heres what I used for making a list of all categories by letter excluding empty letters and with category featured images!

    All you need to do is style it the way you want 😉

    <?php
    
    /* Define which category // to list child categories array('parent'=>42) 42 is category ID */
    $designers = get_terms('product_cat', array('parent'=>42));
    
    /* If categ not empty for each designer take first letter */
    if ( !empty( $designers ) && !is_wp_error( $designers ) ){    
        $term_list = [];    
        foreach ( $designers as $designer ){
            $letter = strtoupper($designer->name[0]);
            $designer_list[$letter][] = $designer;
        }
    unset($designer);
    
    
        foreach ( $designer_list as $key=>$value ) {
            /* Wrap around each designer */
            echo '<div><span>' . $key . '</span><ul>';
    
            foreach ( $value as $designer ) {
                // Set thumbnail
                $thumbnail_id = get_woocommerce_term_meta( $designer->term_id, 'thumbnail_id', true );
                // get the image URL
                $image = wp_get_attachment_url( $thumbnail_id );
                /* List designers */
                echo '<li><a href="' . get_term_link( $designer ) . '" title="' . sprintf(__('Products by %s', 'my_localization_domain'), $designer->name) . '">' . $designer->name . '<img src=" ' .$image.' "" alt="" /></a></li>';
            }
            /* end Wrap around designer */
            echo '</ul></div>';
        }?>
    }