Home › Forums › Front-end Issues › Replace product image with ACF field in Shop page › Reply To: Replace product image with ACF field in Shop page
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’ );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.