I just want to insert a wrapper to the woocommerce_get_product_thumbnail I can see that my wrapper appeared but It doesn't have a fall back image if there's no image.
How do I output the default woocommerce thumbnail?
This is my incomplete code:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
function woocommerce_template_loop_product_thumbnail() {
echo woocommerce_get_product_thumbnail();
}
}
if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) {
global $post, $woocommerce;
$output = '<div class="col-lg-4">';
if ( has_post_thumbnail() ) {
$output .= get_the_post_thumbnail( $post->ID, $size );
} else {
how to show the default woocommerce thumb
}
$output .= '</div>';
return $output;
}
}
echo woocommerce_get_product_thumbnail();
in yourelse
part of the conditional? – Ferree