Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Woocommerce Product Gallery image URLs? [closed]

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.

screen shot of product page

how can I get the URLs of images?

like image 772
Jishad Avatar asked Dec 30 '14 09:12

Jishad


People also ask

How do I find the product image URL in WooCommerce?

“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; ?>">


1 Answers

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 );     } ?> 
like image 158
gaurav kumar Avatar answered Sep 23 '22 18:09

gaurav kumar