Skip to content
Advertisement

What hook for product image replacement in WooCommerce shop page

What function is called when WooCommerce returns image for products in shop page? I would like to replace image with something else.

Advertisement

Answer

To find out, you need look at content-product.php template source code from line 36 to 42:

JavaScript

So when looking at woocommerce_template_loop_product_thumbnail() involved hooked template function source code, you will see that it uses woocommerce_get_product_thumbnail() function:

JavaScript

So to make changes you will have to replace woocommerce_template_loop_product_thumbnail() hooked function by a custom one this way:

JavaScript

To target shop pages only, you will use is_shop() conditional tag.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement