• Hello, can you explain me why we cannot just change the placeholder.png picture file in
    /wp-content/plugins/woocommerce/assets/images

    Why isn’t Woocommerce using the new image that I put there ?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Its not a good idea to just replace the placeholder image because your custom image will itself be replaced during the next WooCommerce update.

    WooCommerce might not be using that image because the image url has been changed by some other software element in your setup.

    You can set your own image url using this code snippet:

    <?php
      // set custom product image
      add_filter ('woocommerce_placeholder_img_src', 'my_placeholder', 99);
      function my_placeholder() {
        return get_site_url().'/wp-content/uploads/custom_placeholder.jpg';
      }
    

    The link goes to your custom image which you have uploaded using the media manager.

    This snippet can go in your child theme’s functions.php or you can use the “My Custom Functions” plugin.

    Thread Starter makeonlineshop

    (@makeonlineshop)

    Hello,

    Thank you for your reply. I didn’t know that the image would be replaced by each Woocommerce update.

    Is your code similar to what I found on some other websites ?

    Is there any difference to use one code or another ?

    Thank you so much for your help.

    // Add action to hook into the approp
    add_filter( ‘woocommerce_placeholder_img_src’, ‘growdev_custom_woocommerce_placeholder’, 10 );
    /**
    * Function to return new placeholder image URL.
    */
    function growdev_custom_woocommerce_placeholder( $image_url ) {
    $image_url = ‘/wp-content/plugins/woocommerce/assets/images/placeholderMODIFIED.png’; // change this to the URL to your custom placeholder
    return $image_url;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘placeholder.png How to change woocommerce placeholder image directly via FTP ?’ is closed to new replies.