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

Variations swatches plugin not compatible with product filter plugin

Hi.  This issue has been raised elsewhere but I have not seen a solution.

 

When using Woocommerce Product filters plugin, swatches do not work after you filter.  They work on page load, but if a filter is selected the swatches no longer work.

 

Can you advise please.

Beth

Hakik Zaman

Hi David,

Thanks for reaching us.

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

Please contact your filter plugin author and ask them to send a trigger like the following as the Malinky Ajax Pagination plugin provides.

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

Thank You

Hakik Zaman

Hi David,

Here is the example snippet. Just replace the YOUR_TRIGGER with the actual trigger.

Add the following snippet inside your current theme’s functions.php file-

add_action( 'wp_footer', function(){
?>
<script id="wvs-ajax-compatibility-150815" type="text/javascript">
jQuery(document).on("YOUR_TRIGGER", wvs_ajax_done_handler_150815);
function wvs_ajax_done_handler_150815(e) {
jQuery(document).trigger("woo_variation_swatches_pro_init");
}
</script>
<?php
}, 99 );

Note: It is recommended to add the Custom Code to the child theme’s functions.php file, to avoid any data loss while updating the Parent Theme.

Thank You