Reputation: 71
I would like to ask how to customize woo commerce products images.I want to add alt title featured products. Iv'e been tweaking on the functions.php . I saw woocommerce_get_product_thumbnail() how could I customize this to output the image title like this one:
<img src="www.source.com" title="image title">
Upvotes: 1
Views: 608
Reputation: 11690
You could do it like this
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
if (!function_exists('change_product_image')) {
function change_product_image( $html ){
global $post;
$html = get_the_post_thumbnail( $post->ID, 'full' );
echo $html;
}
}
add_action( 'woocommerce_before_shop_loop_item_title', 'change_product_image', 10 );
First you remove the default action from woocommerce that displays the image, then you output yours with your function.
You can play around with this. Change size, find out attributes of each image etc.
Upvotes: 1