Change the default WooCommerce placeholder image

// PHP

What it does

Change the default product placeholder image in WooCommerce.

In this example, we have created a new image called placeholder.jpg and uploaded it to the uploads folder.

The Code

add_action( 'init', 'guyPrimavera_wc_placeholder_image' );
function guyPrimavera_wc_placeholder_image() {
  add_filter('woocommerce_placeholder_img_src', 'guyPrimavera_placeholder_img_src');
	function guyPrimavera_placeholder_img_src( $src ) {
	$upload_dir = wp_upload_dir();
	$uploads = untrailingslashit( $upload_dir['baseurl'] );
	$src = $uploads . '/placeholder.jpg'; // This will grab the image "placeholder.jpg" in your WP uploads directory
	return $src;

How To Use It

Paste this snippet into your theme's functions.php or in a WordPress plugin.