Monday, January 17, 2022
Wordpress Tricks

Woocommerce get product gallery images url

How to add custom meta title and meta description in Wordpress?

Woocommerce get product gallery images url

Hello, welcome to In this post, I will tell you How to get Woocommerce product gallery images url? WordPress is the best cms like I always say. In wordpress custom query post, we will get Woocommerce product gallery images url.


$args = array(
‘post_type’ => ‘product’

// Custom query.
$query = new WP_Query( $args );

// Check that we have query results.
if ( $query->have_posts() ) {

// Start looping over the query results.
while ( $query->have_posts() ) {


// Contents of the queried post results go here.
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
/*gallery Images code*/
foreach( $attachment_ids as $attachment_id )
$image_link = wp_get_attachment_url( $attachment_id );
/*gallery Images code*/



// Restore original post data.


There are so many tricky code in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you.

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, Angular 8, Angular 9, Angular 10, Angular 11, Angular12, Angular 13, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.