How to Change WooCommerce Placeholder Image?

WooCommerce uses the WordPress Featured Image as the main image on product pages. When the Featured Image has not yet been set for a product then WooCommerce display defaults placeholder image. If you want to change WooCommerce defaults placeholder image then you have to follow the steps given below.

Change WooCommerce Placeholder Image

1. Use an image of correct size 

You have to create an image of the dimensions required by your theme. When you have the image ready, from the WordPress admin dashboard hover over the Media menu option and click on Add New. Drag and drop the new image onto the page and it will be uploaded to the site.

media uploader

When the image is done uploading press the Edit link to see image details. Copy the File URL field for use in the next step.

image editor

2. Add code in functions.php file

To replace the default placeholder image you need to add the following lines of code in your theme's functions.php file. Just append the following lines of code at the bottom of functions.php

add_filter( 'woocommerce_placeholder_img_src', 'magik_custom_woocommerce_placeholder', 10 );

//  Function to return new placeholder image URL. 
function magik_custom_woocommerce_placeholder( $image_url )
 {
    $image_url = 'http://192.168.3.49/wpverito/wp-content/uploads/2016/11/placeholder-image-450x450.gif'; 
   // change  this to the URL to your custom placeholder
    return $image_url;
 }

Replace the URL with the URL  you’ve copied for newly uploaded image and hit save.

Now refresh the shop/category page and you’ll see the new placeholder image.

place holder image

If you face any problems or need our professional services, please email us at [email protected].

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.