fbpx
🤝 CYBER MONDAY & FRIDAY SALE RETURNS - 50% OFF all plans! 🤝 Grab it Now

Issue with loading of swatches

Hello, all swatches are work if loading with a page opening, but when scrolling down and loaded some more products, the swatches for them do not work. Please see on photo.Loading issue.jpg

Hakik Zaman

Hi Petr,

Thanks for reaching us.

We need an event from your “load more” plugin that should be triggered after new products are loaded.

Just send this plugin to your plugin developer: https://wordpress.org/plugins/malinky-ajax-pagination/

Ask them to send a trigger like the following as the Malinky Ajax Pagination plugin provides.

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

Like this filter plugin: https://woocommerce.com/products/product-filters/

jQuery(document).ready(function( $ ){
// Your code in here
jQuery(window).on(‘wcpf_update_products’, function () {
console.log(‘Hi’);
});
});

Thank You

Sorry, I didn’t understand which plugin do you mean. I didn’t instal infinity type plugin, it was standard with a theme, but support is experired. Unfortunately based on my experience, I doubt they will add third party code.  Is there other solution?

Hakik Zaman

Hi Petr,

Sorry, I didn’t understand which plugin do you mean. I didn’t instal infinity type plugin, it was standard with a theme, but support is experired.

If it is coming from the theme, please get the trigger from the theme team.

Unfortunately based on my experience, I doubt they will add third party code

We have no need for the code or support. We just need the trigger name that fired after more products were displayed.

I hope I could clear up your confusion.

In the meantime, you can send us the latest version of the theme that you are using on your site. We’ll try to find the trigger by installing your theme on our local setup. But I can’t assure you that we can find it. Because they know their codebase better than us.

You can upload the theme file in Dropbox or Google Drive and send the download link here directly.

Another solution is to turn off the Ajax product loading from the theme. Then use a plugin that does the same and provides the trigger.

Thank You

Hakik Zaman

Hi Petr,

Unfortunately, they didn’t keep a trigger to regenerate our swatches script.

It is a common and good practice to keep a trigger when developing this kind of feature.

The only way is by modifying the site.js file of your theme.

Here is the file path: ‘luchiana > assets > js > site.js

Then edit the line number 2086. You have to add this trigger: $(document).trigger('woo_variation_swatches_pro_init');

Here is the guideline: https://i.imgur.com/TfosoZV.png

After adding the line you have to flush your caches like- browser cache, caching plugin cache, and server-side cache.

Hope to hear from you soon.

Thank You

Thanks, it works. But also have another question. When I click the “Add to Cart” button at archive page, products are added to cart and the product page loads at the same time. How to make only the add to cart option work without redirecting to the product page?

Hakik Zaman

Hi Petr,

Can you please give us temporary admin access to your site? We’ll try to investigate the issue for you.

You can add new users by going to Users > Add New set the user and password for us, set the role to admin, and set the info here.

Add your site URL, login username, and password in the site login area. Follow this guideline: https://www.useloom.com/share/27c1f2ac633c4060b2da883d946107d7

Hope to hear from you soon!