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

Price not shown on archive page when a single variation is selected

Joel Mellin

Hi,

After investigation I open a ticket again regarding the issue.

https://www.awesomescreenshot.com/video/29360371?key=6b1739e2ef403096e65e786df21cc0a7

The problem with the swatches is there if the Woo filter is used. As I explain in the video I do not know where the problem lies, if it is with the swatches or with the filter, or a combination thereof.

Hakik Zaman

Hi Joel,

Thanks for getting back to us.

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

Please ask for a trigger from your filter plugin author that fires after new products are loaded.

So, that I can help you to reinitiate our Swatches script after filtering products.

Hope to hear from you soon.

Thank You

Joel Mellin

Hello @joelmellin,

I think we have the right hook for you.

wpfAjaxSuccess

This is how to use it:

document.addEventListener(‘wpfAjaxSuccess’, function(event) {console.log(‘Custom js’);});

Hakik Zaman

Hi Joel,

Please add the following snippet using a plugin called Code Snippets or add it inside your current child theme’s functions.php file:

add_action( 'wp_footer', function(){
?>
<script id="wpfajaxsuccess-wvs-ajax-compatibility" type="text/javascript">
jQuery(document).on("wpfAjaxSuccess", wpfajaxsuccess_wvs_ajax_done_handler);
function wpfajaxsuccess_wvs_ajax_done_handler(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.

Then try again. Before checking please flush your caches like- browser cache, caching plugin cache, and server-side cache.

Thank You

Joel Mellin

Thanks, if I add it as a code snippet it will be no data loss while updating the parent theme right? I mean it does not matter if I add it as a code sippet or directly in the child themes funcipns.php?

Joel Mellin

I have now added the snippet, but nothing is changed. The same issue is still there. I flushed the cache,  but no difference.

Hakik Zaman

Hi Joel,

I have modified the script on your site:

add_action( 'wp_footer', function(){
?>
<script id="wpfajaxsuccess-wvs-ajax-compatibility" type="text/javascript">
document.addEventListener('wpfAjaxSuccess', function(event) {
//console.log("Hakik");
jQuery(document).trigger("woo_variation_swatches_pro_init");
});
</script>
<?php
}, 99 );

Now it is working from my end – https://www.loom.com/share/89f489d9b3e94a2fa2bf56ffad5efe69. Please check now and flush your caches like- browser cache, caching plugin cache, and server-side cache.

Thank You

Hakik Zaman

Hi Joel,

It works when you hit this link- https://mellins.nu/?wpf_count=48&wpf_filter_cat_1=800

Then uncheck the “Bönor, Linser, Ärtor” and recheck it again.

But it is not working after the initial load https://mellins.nu/.

To understand it clearly, I have displayed “Hakik” using the given event.

If you check it carefully, you can see it is displayed before “XHR finished loading”.

Here is a screenshot for your convenience- https://paste.pics/RCRHY

Please contact the filter plugin author and ask them for an event that fires after all content loads.

Then we can try our trigger for that event.

Thank You