How to replace default product placeholder image in WooCommerce

If you add new product in woocommerce and you don’t add any image of that product than woocommerce add by default placeholder image and display this placeholder image. If you want to change or replace default product placeholder image in WooCommerce that let’s do this.

first select any one product image from your pc and upload it on your wordpress backend media. After uploading this image. Click this image/ Edit this image and copy the url of image.

Now go with your theme’s functions.php file of your active child theme (or theme) and add below line of code.
In $src=’ ‘ . add here to image url which product image you want to add instead of placeholder image.

add_filter('woocommerce_placeholder_img_src', 'wdo_custom_woocommerce_placeholder_img_src');

function wdo_custom_woocommerce_placeholder_img_src( $src ) {
	$upload_dir = wp_upload_dir();
	$uploads = untrailingslashit( $upload_dir['baseurl'] );
	// replace with path to your image
	$src = $uploads . '/2018/05/woocommerce-placeholder-image.jpg';
	 
	return $src;
}

Leave a Comment

Scroll to Top