Home › Forums › Add-ons › Repeater Field › Img src stays empty › Reply To: Img src stays empty
Hi @tanK
Your code contains a few errors:
1. You have selected a return type of ID on the image field. This will cause $product[‘product_image’] to contain and ID of the image
2. Your code references $product[‘sizes’][‘product_image’], but this will never exist. The image ID will sit at $product[‘product_image’]. This is an ID, not a URL
I think what you want to do is set the image return type to ‘Image Object’, then use this code:
echo '<img src=”'.$product['product_image']['sizes']['product_image'].'”>';
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.