Skip to content

Instantly share code, notes, and snippets.

@mohsinoffline
Last active October 9, 2021 09:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsinoffline/f06c66259e667d6b16bb to your computer and use it in GitHub Desktop.
Save mohsinoffline/f06c66259e667d6b16bb to your computer and use it in GitHub Desktop.
WooCommerce: Increase variation threshold to prevent AJAX
<?php
function ww_ajax_variation_threshold( $default, $product ) {
return 50; // increase this number if needed
}
add_filter( 'woocommerce_ajax_variation_threshold', 'ww_ajax_variation_threshold', 10, 2 );
?>
@giannischiout
Copy link

Hi, how do i properly ad this to my childs theme? Where do i place it? Will it need any changes in the future, and why would that be? Thank you very much!

@sandeepb633
Copy link

where i have to place the above code

@imhugos
Copy link

imhugos commented Jun 17, 2021

where i have to place the above code

Hi, I hope it's not too late... You can place this code on functions.php of your theme / child theme.

@tarik8844
Copy link

i want to set this kind of variations
product
select 4 variations for free from 10
select 1 variation from 4
if seleceted new variation price for each selection is 2$ for example
this is helpful for composition of salad for example
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment