in

Change Default Product’s Placeholder Image in WooCommerce

Placeholder Image in WooCommerce

Upload your prefered image to WordPress Media Library. Copy the URL of that image. Then add below snippet to the bottom of functions.php file:

//* Function to change product placeholder image.
add_filter( 'woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder', 10 );

function custom_woocommerce_placeholder( $image_url ) {
  $image_url = 'https://hpthemes.com/wp-content/uploads/2017/06/identity.png';
  return $image_url;
}

Paste your image’s URL to $image_url variable value above.

Adding function to functions.php file should be amended to a child theme. If you make this change to the parent theme, the code would be wiped out when the theme is updated.

To safely adding this function and others, you can use Code Snippets plugin.

What do you think?

Leave a Reply

Your email address will not be published.

Gravity Forms Fully Works

How to Make Gravity Forms Fully Works

Genesis Child Theme

Customize Genesis Child Theme Breadcrumb and Entry Meta