WooCommerce product gallery and featured image

Hi,

I was able to follow this video to create a custom gallery:
https://www.youtube.com/watch?v=40Z5V7FBx4A&t=343s

And then followed this post to link that gallery to my WooCommerce Product page:

However, {{dc:post:featured_image post="{{dc:looper:item}}"}} only pulls the gallery images and does not include the featured product image.

Is there a way to have the gallery pull both the product image/featured image and the product gallery images?

I appreciate that I could just add the featured image to the product gallery, but as I’m redesigning an existing shop, there are already hundreds of live products.

Thanks in advance.

Hi @Nate_Sheridan,

Thanks for reaching out.
In the given Dynamic Content tag {{dc:post:featured_image post="{{dc:looper:item}}"}} it’s not entirely clear what {{dc:looper:item}} is returning. Please make sure it returns the Post ID for which the Featured Image should be displayed.
For reference, passing the Post ID in the given code should return the Featured Image.

{{dc:post:featured_image post="1922"}}

Hope it helps.
Thanks

Thanks for the reply.

Here’s some more context: I have create a WooCommerce Single layout. I’m using {{dc:woocommerce:product_gallery_ids}} as the gallery’s looper provider, but this does not pull through the product image. Only the product gallery images.

Ideally I’d like the main slide to show the product image and for it to also appear in the slider image pagination.

Hi @Nate_Sheridan,

For {{dc:woocommerce:product_gallery_ids}}, it returns the images added under the gallery, and it is not possible to show the featured image with those. If you still want to do it, you can create your own custom looper method that returns the combination of featured image and gallery images.
I would suggest you go through the following thread on the custom looper.



You can use the global Product object to call the get_image_id() and get_gallery_image_ids() and combine the values into a single array to return. If you are not proficient in this, I would suggest you hire a developer who can assist you to do the customization, or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

1 Like

Thank you Tristup!

I was able to achive this with a bit of custom code. It’s great that I can create my own custom looper method that returns the combination.

Thank you so much for pointing me in the right direction.

Hi @Nate_Sheridan,

Glad that we are able to help you.

Thanks