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

Problem loading additional products in Ajax

haim tabka

Hello,
I have in the product archive a load of additional products with infinite scrolling in Ajax.

Selection of variations does not cause problems on the archive page, but as soon as he loads additional products with Ajax, then in the loaded products it is not possible to select variations on the archive page.
The variations don’t work.

Attach photos.

Link for testing and example: https://hm-mobile.co.il/product-category/%d7%a1%d7%9e%d7%90%d7%a8%d7%98%d7%a4%d7%95%d7%a0%d7%99%d7%9d/

I would appreciate a quick answer.
Thank you

1.jpg

2.jpg

Hakik Zaman

Hi haim,

Thanks for reaching us.

We need an event from your Load More plugin should be triggered after new products are loaded.

Please send the following sample code to the author of the Load More plugin you are using on your site. Ask for some kind of the following trigger-

document.addEventListener(‘malinkyLoadPostsComplete’, function(e) {
console.log(‘LoadPostsComplete’);
});

Thank You

haim tabka

Hi, thanks but web developer couldn’t understand. Should I add the code you attached to the functions file?

Hakik Zaman

Hi haim,

Hi, thanks but web developer couldn’t understand. Should I add the code you attached to the functions file?

Did you send it to your web developer? I have requested you to contact the Load More plugin developer with the above event example.

Which Load More plugin are you using on your site?

Thank You

Hakik Zaman

Hi haim,

Please contact the Elementor Pro support regarding the event.  If they provide an event, for example- `some_event`

Add the following snippet using the Code Snippets Plugin. Just replace the `some_event` with the given event name by Elementor Pro.

add_action('wp_footer', function(){
?>
<script id="gwp-elementor-pro">
jQuery(document).on('some_event', function(){
jQuery(document).trigger('woo_variation_swatches_pro_init');
});
</script>
<?php
}, 99);

If they don’t want to help with the event, please use this plugin- https://wordpress.org/plugins/load-more-products-for-woocommerce/

The mentioned plugin is compatible with our Swatches plugin.

Thank You