I am developing a wordpress woo commerce shopping site and added some products. i want to get the product gallery image urls of each products.
how can I get the URLs of images?
“get product image woocommerce” Code Answer's php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $product_id ), 'single-post-thumbnail' );?> <img src="<? php echo $image[0]; ?>" data-id="<? php echo $loop->post->ID; ?>">
Try this:
<?php global $product; $attachment_ids = $product->get_gallery_image_ids(); foreach( $attachment_ids as $attachment_id ) { echo $image_link = wp_get_attachment_url( $attachment_id ); } ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With