Press "Enter" to skip to content

Get Woocommerce Shop Page featured image URL

Imagine you created a woocommerce (WordPress) website and wasted hours time to get the URL of the Shop Page Featured Image ? here this small snippet will help to print the featured image URL where you want ๐Ÿ˜‰

function get_shop_featured_image() {
    if( is_shop() ) {
        $shop = get_option( 'woocommerce_shop_page_id' );
        if( has_post_thumbnail( $shop ) ) {
            $post_thumbnail_id = get_post_thumbnail_id($shop);
            $post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );
            echo $post_thumbnail_url;
        }
    }
}

Cool isn’t it ? ๐Ÿ˜€ paste this code on functions.php then call the function get_shop_featured_image(); as usual wordpress function ๐Ÿ˜€

Joel Jerushan
Joel Jerushan

A Young Web Developer & Graphic Designer from Batticaloa Sri Lanka unrestrained desire to collect new experiences.

View all posts

    Leave a Reply