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

Hook to insert element after feature image

Davide Ralli

Hi, I purchased your plugin and I need to insert an element after the main product image. The classic woocommerce hooks seems doesn’t work.

There’s some plugin hook that I can use to do that, or can I create my custom template theme child folder?

Thank you

Schermata 2021-10-13 alle 10.03.41.png

Hakik Zaman

Hello Davide,

Thanks for reaching out to us. Unfortunately, right now no hook is available between the main image and thumbnails.

Please create a folder inside your child’s theme and name it “template“. Then copy the file product-images.php from woo-variation-gallery/single-product and paste it inside the newly created template folder. Then paste the below code inside your child theme’s functions.php

function edit_wvg_gallery_template($template, $template_name, $old_template){

if ( $template_name == 'single-product/product-image.php' ) {
$template = get_template_part('template/product', 'images');
}
return apply_filters( 'wvg_gallery_template_override_location_new', $template, $template_name, $old_template );
}

add_filter('wvg_gallery_template_override_location', 'edit_wvg_gallery_template', 30, 3);

Now change whatever you want inside your child theme > template > product-images.php

Thanks

Davide Ralli

Hi, I’ve update plugin some days ago. The update broke the customization in my template and my element is not visible anymore.

Did you change the hook wvg_gallery_template_override_location?

Waiting for your answer!

Hakik Zaman

Hi Davide,

Yes, we have changed so many things in our latest update. Please try this-woo_variation_gallery_gallery_template_override_location

Thank You

Davide Ralli

Ok, the hook was right but I needed to update some functions in my template file

Hakik Zaman

Hi Davide,

Glad to know you identified.

Is everything alright from your side?

Can I close this ticket for now? 🙂

Thank You

Davide Ralli

Yes, alright. You can close the ticket.

Thank you!