fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Tolga Semirli

Hi,

We use JTL Wawi as the ERP system on our site. JTL states that it is compatible with Wawi “Additional Variation Images Gallery”.(Link)

Variation gallery sorting is correct in JTL Wawi. When we start sending products from JTL to woocommerce, the variation gallery order on our site is reversed.

Example variation image order is below.

JTL Wawi photo sorting

1. photo1.jpg
2. photo2.jpg
3. photo3.jpg
4. photo4.jpg

Variation Gallery photo sorting
1. photo1.jpg
2. photo4.jpg
3. photo3.jpg
4. photo2.jpg

Do we have a solution for this?
Or is there a function.php code where we can reverse the variation gallery on the front-end?

Hakik Zaman

Hi Tolga,

Thanks for reaching out to us. Unfortunately, right now, we have no option to reverse the gallery images.

But you can try the following snippet using Code Snippets Plugin:

add_filter('woo_variation_gallery_attachment_ids', function( $attachment_ids, $post_thumbnail_id, $product ){
   return array_reverse($attachment_ids);
}, 10, 3);

Thank You

Tolga Semirli

I tried but it didn’t work. Can you give more detailed information so that I can run it?

Hakik Zaman

Hi Tolga,

We keep the image IDs in $attachment_ids and display them using the slick slider.

If the above snippet doesn’t work. Unfortunately, it is not possible to reverse the gallery images.

Because it is displayed using a third-party JS library.

Thank You