Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #622500

    Hey,

    I tried these:

    http://stackoverflow.com/questions/27844825/how-does-one-replace-woocommerce-default-placeholder-image-for-shop-categories#answers-header
    https://docs.woothemes.com/document/change-the-placeholder-image/

    How to Customize the WooCommerce Placeholder Image

    But dont work… :( Do you have any idea?

    Kind regards,
    Peter

    #622513

    Hm, I see the placholder image on the backend and I see the placeholder image on the singel product page… but I dont see the placeholder image on the shop / catalog page.

    Thank you

    #624323

    Hi,

    Thank you for using Enfold.

    The theme is not using the default product thumbnail template. Add this in the functions.php file to add a placeholder:

    add_action( 'after_setup_theme', 'after_setup_theme_mod' );
    function after_setup_theme_mod(){
        remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 10);
        add_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail_mod', 10);
    }
    
    function avia_woocommerce_thumbnail_mod($asdf)
    {
    	global $product, $avia_config;
    	$rating = $product->get_rating_html(); //get rating
    
    	$id = get_the_ID();
    	$size = 'shop_catalog';
    
    	echo "<div class='thumbnail_container'>";
    		echo avia_woocommerce_gallery_first_thumbnail( $id , $size);
    		$thumbnail =  get_the_post_thumbnail( $id , $size );
    		if(!empty($thumbnail)) {
    			echo $thumbnail;
    		}
    		else {
    			echo "<img src='PLACEHOLDER IMAGE HERE'/>";
    		}
    
    		if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>";
    		if($product->product_type == 'simple') echo "<span class='cart-loading'></span>";
    	echo "</div>
    ";
    }

    Adjust the src attribute “PLACEHOLDER IMAGE HERE”.

    Best regards,
    Ismael

    • This reply was modified 8 years, 6 months ago by Ismael.
    #630840

    Amazing it’s work! :) Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce placeholder image’ is closed to new replies.