<?php
// Re-trigger YITH wish list init after FacetWP refreshes (after facet filtering)
add_action( 'facetwp_scripts', function() {
?>
<script>
document.addEventListener('facetwp-loaded', function() {
/** wishlist */
jQuery(document).trigger( 'yith_wcwl_init' );
});
</script>
<?php
});
// If the above does not work, try the following.
// Trigger DOMContentLoaded after FacetWP refreshes (after facet filtering)
add_action('facetwp_scripts', function () {
?>
<script>
document.addEventListener('facetwp-loaded', function() {
if (FWP.loaded) {
window.document.dispatchEvent(new Event("DOMContentLoaded", {
bubbles: true,
cancelable: true
}));
}
});
</script>
<?php
}, 100);