Products without image should display WooCommerce’s placeholder image.
-
I think that in order to be more compliant to WooCommerce, the template for the products in the “shop” section in the front page could use like in
woocommerce/single-product/product-image.php
:if ( has_post_thumbnail() ) { $html = '<div data-thumb="' . get_the_post_thumbnail_url( $post->ID, 'shop_thumbnail' ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url( $full_size_image[0] ) . '">'; $html .= get_the_post_thumbnail( $post->ID, 'shop_single', $attributes ); $html .= '</a></div>'; } else { $html = '<div class="woocommerce-product-gallery__image--placeholder">'; $html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src() ), esc_html__( 'Awaiting product image', 'woocommerce' ) ); $html .= '</div>'; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Products without image should display WooCommerce’s placeholder image.’ is closed to new replies.