Mika MAtikainen

Apr 15, 2020 · 4 min read

How to Display Category Image on Archive Page in Woocommerce?

        
        function wps_woo_add_category_image() {

        if ( is_product_category() ){
            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 );
            if ( $image ) {
            echo '';
            }
        }

        }
        add_action( 'woocommerce_archive_description', 'wps_woo_add_category_image', 2 );
        
    

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This