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

ajax variation threshold

Hello, my products have more than 100 variations, the plugin no longer has the advanced option to set the ajax variation threshold, and I tried installing code snippet but it is not working. Could you help me?

Rezwan Shiblu

Hi there,

Thanks for reaching out to us.

Please install and activate the Code Snippets plugin and add the below snippet:

add_filter( 'woo_variation_swatches_global_ajax_variation_threshold_max', 'woo_variation_swatches_global_ajax_variation_threshold_max_edit', 10, 2 );
function woo_variation_swatches_global_ajax_variation_threshold_max_edit( $size, $product ){
   return 700;
}

Then let me know if it resolves your issue or not.

Thank You

Hi, thank you. I tried it but it doesn’t work. I just added a new one and paste the snippet. Did I miss domething?

Hi again, I tried this one and it worked!
function iconic_wc_ajax_variation_threshold( $qty, $product ) {
return 300;
}

add_filter( ‘woocommerce_ajax_variation_threshold’, ‘iconic_wc_ajax_variation_threshold’, 10, 2 );

Rezwan Shiblu

Hi there,

Glad to hear it worked.

If you encounter any other issue you require support on, feel free to open a new ticket.

I’m happy to assist

Thank you.