loading
I currently have availability
logo

Hi, I'mKevin Shoffner

Customize WooCommerce Placeholder image

Occasionally I have clients ask to have a custom WooCommerce placeholder.png used instead of what comes with the plugin. And I am going to tell you how to fix it quickly and painlessly.

If you have ever been on a WooCommerce site, or set up a site using WooCommerce, I am sure you have seen this guy:

If you are super lucky to have this as part of your brand, then you are able to walk away now. But if you have a brand that needs a bit more excitement, then you will want to keep reading. But don’t worry, I am going straight to the point. No fluff…

  1. Upload an image that is 450×450 to your Media Library
  2. Get the URL from the Media Library, and copy it
  3. Go to your Theme’s function.php file and add the below snippet of code


// Add filter
add_filter( 'woocommerce_placeholder_img_src', 'myAwesome_custom_woocommerce_placeholder', 10 );
/**
* Function to return new placeholder image URL.
*/
function myAwesome_custom_woocommerce_placeholder( $image_url ) {
$image_url = 'http://domain.com/wp-content/uploads/2017/08/placeholder.png'; // change this to the URL to your custom placeholder
return $image_url;
}

As as I tell people all the time = the code ninja has done the job. Now no matter if WooCommere plugin gets updated, your default placeholder.png image will not be replaced.

 

Have other ideas, feedback, or complaints? I’ll be here.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: