Home Forums Front-end Issues Replace product image with ACF field in Shop page


Replace product image with ACF field in Shop page

  • Hi there,

    I’m wondering whether this is possible:

    I would like to replace the product images in the loop, with a custom ACF field.

    The client would like to show a different image on single-product.php than on archive.php.


  • This would require some programming. You would want to use some WooCommerce hooks. Probably this hook “woocommerce_product_thumbnails”. But it might require others too.

  • Hi, thanks for the tip.

    This is how I managed to solve it:

    function replacing_template_loop_product_thumbnail() {

    remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10 );

    function wc_template_loop_product_replaced_thumb() {
    $shop_image = get_field( ‘shop_oldal_kep’ );

    echo ‘</img>’;
    add_action( ‘woocommerce_before_shop_loop_item_title’, ‘wc_template_loop_product_replaced_thumb’, 10 );
    add_action( ‘woocommerce_init’, ‘replacing_template_loop_product_thumbnail’ );

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.