Change Loop Thumbnail HTML in shop page Woocommerce

To change the loop thumbnail HTML in the shop page of WooCommerce, you can use the woocommerce_before_shop_loop_item_title hook. This hook is used to add content before the product title in the loop.

Here’s an example code snippet that demonstrates how to change the loop thumbnail HTML in the shop page of WooCommerce:

function loop_product_thumbnail() {
    // Remove product images from the shop loop
    remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
    // Adding something instead
    function wc_template_loop_product_replaced_thumb() {
        echo "Your text or Image ";
    }
    add_action( 'woocommerce_before_shop_loop_item_title', 'wc_template_loop_product_replaced_thumb', 10 );
}
add_action( 'woocommerce_init', 'loop_product_thumbnail');

Leave a Reply

Your email address will not be published. Required fields are marked *