How to add page’s featured image to wocommerce’s shop page ?

In this tutorial we’ll learn how to display page featured image to wocommerce’s shop page. By default woocommerce’s shop page only displays product lists and it won’t display featured image.

Here is what default shop page looks like:

woocommerceNow, first of all set a featured image for shop page. To do this go to pages and click the shop page to edit it.

woocommerce

Now set the featured image for this page. You can set featured image from here:

woocommerce

Now after setting image:

woocommerce

Update the page.

After setting image, add the following lines of code at the end of your theme’s functions.php file.

add_action(‘woocommerce_before_main_content’, ‘wp176545_add_feature_image’);

function wp176545_add_feature_image() {

echoget_the_post_thumbnail( get_option( ‘woocommerce_shop_page_id’ ) );

}

You can access functions.php file here:

woocommerceNow go to shop page from front end and you’ll see the featured image being displayed there.

woocommerce

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *