Website Building » WooCommerce » How Do I Change the Default Product Image in WooCommerce?

How Do I Change the Default Product Image in WooCommerce?

Last updated on October 1, 2022 @ 2:56 pm

By default, WooCommerce will use the “placeholder” image for products that have not yet been given a featured image. This can be changed in the WooCommerce settings.

Go to WooCommerce > Settings > Products and select the Placeholder tab. From here, you can upload your own default image, or select one from the media library.

If you have a lot of products without featured images, then it may be easier to change the default image in the code. To do this, you’ll need to open the functions.php file in your child theme and add the following code:

function wc_change_default_image($src){

$src = ‘/path/to/new/default/image.jpg’;

return $src;

}

add_filter(‘woocommerce_placeholder_img_src’, ‘wc_change_default_image’);

Once you’ve added this code, you’ll need to replace ‘/path/to/new/default/image.jpg’ with the URL of your new default image. You can find this by going to Media > Library, selecting your image, and then copying the URL from the “File URL” field.

PRO TIP: If you are using a WooCommerce plugin and want to change the default product image, be aware that this may affect your product page’s layout and could cause display issues. Proceed with caution and backup your site before making any changes.

Conclusion:

It’s easy to change the default product image in WooCommerce if you know where to look. The setting is located in WooCommerce > Settings > Products, and from there you can upload your own default image, or select one from the media library.

If you have a lot of products without featured images, then it may be easier to change the default image in the code. To do this, open the functions.php file in your child theme and add the following code:

function wc_change_default_image($src){

$src = '/path/to/new/default/image.jpg';

return $src;} 

add_filter('woocommerce_placeholder_img_src', 'wc_change_default_image'); 

 

 
Drew Clemente

Drew Clemente

Devops & Sysadmin engineer. I basically build infrastructure online.