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

Don’t override full slider html on variation image switch

Hello there,

A client of us wants to combine our plugin (3D viewer by Visody) with your Variation Images Gallery plugin

We append the model viewer html to the slides html to update the variation 3D model viewer

Unfortunately your plugin replaces the full slider html after variation change, resulting in the loss of the 3D viewer

It would be very tricky for us to add the model viewer back in every time

Do you see a chance to optimize the code to replace images only?

See uploaded image for our model structure

Looking forward to your reply

Best regards,

Team Visody

Hakik Zaman

Hi Visody,

Thanks for reaching out to us. I have tried to contact using your support page.

Unfortunately, your site was not working so couldn’t connect with you.

I recommend https://snipboard.io for easily sharing screenshots – please follow the instructions on that page, then paste the URL in this thread.

Hope to hear from you soon.

Thank You

Hello Hakik,

Thank you for getting back to me.

Was the site not working or the form not working?

here is link to image: https://snipboard.io/h9pjQy.jpg

Let me know if you can find solution for this

Or maybe add in hook which we can use to ensure 3d viewer will always be visible

Hakik Zaman

Hi Visody,

Was the site not working or the form not working?

The form was not working. After adding all the required fields I was unable to submit it.

You can add your markup here – woo-variation-gallery > includes > slider-template-js.php

This template loads when someone selects a variation. Here is a code sample to override the slider-template-js.phphttps://smalldev.tools/share-bin/yNnmFODu

You can override the template to add the markup.

All the data properties can be found here- woo-variation-gallery > includes > class-woo-variation-gallery-frontend.php > line number 334

If you need more properties you can use the filter hook- woo_variation_gallery_get_image_props

Please let me know if this helps.

Thank You

Hello Hakik,

Thank you for sharing code example.

Do you also have JS hooks we can hook into?

Looks like the override contains a scripting template

Let me know

Hakik Zaman

Hi Visody,

Thanks for getting back to us.

Do you also have JS hooks we can hook into?

Please check the following triggers:

$(document).on('woo_variation_gallery_init', function () {
   // Do something here
});

Or,

$(document).on('woo_variation_gallery_slider_slick_init', function(){
// Do something here
});

Please let me know if this helps.

Thank You

Hello Hakik,

Thanks! And do you also have init on variation update?

Since the html gets replaced on variation update as well?

Let me know!

Cheers!

Hakik Zaman

Hi Visody,

Please try these triggers-

$(document).on('woo_variation_gallery_image_loaded', function(){
// Do something here
});

$(document).on('woo_variation_gallery_variation_images', function(){
// Do something here
});

Thank You

Hello Hakik,

That worked, thanks!

Do you also have suggestion for “on variation form reset” hook?

Now I have to use a timeout on the WooCommerce “reset_form” hook to make it work.

Maybe there is a hook from your plugin I can use for after variation form reset?

Looking forward to your reply!

 

Hakik Zaman

Hi Visody,

I think there is a trigger from WooCommerce- reset_image

I hope this will work. Hope to hear from you soon.

Thank You