Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce - Change ajax variation threshold
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 10;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );
@guru75

This comment has been minimized.

Copy link

commented Sep 25, 2018

not working on 200 variation product.

@guru75

This comment has been minimized.

Copy link

commented Sep 25, 2018

This works for 200 variation product

function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 200;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 100, 2 );

@dnavarrojr

This comment has been minimized.

Copy link

commented Apr 14, 2019

Not working in WordPress 5.1 and WooCommerce 3.5.7

@jcvikl

This comment has been minimized.

Copy link

commented May 24, 2019

Do you generate new file under Woocoomerce plugin folder or you put code into functions.php themes file?

@ZanekShaw

This comment has been minimized.

Copy link

commented Jul 5, 2019

Hey, I'm using the following code but it doesn't seem to work for me.
Any advice would be greatly appreciated.


/**
 * Change woocommerce_ajax_variation_threshold
 */
function custom_wc_ajax_variation_threshold( $qty, $product ) {
	return 200;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 100, 2 );

@VdVwebdesign

This comment has been minimized.

Copy link

commented Jul 5, 2019

Hey, I'm using the following code but it doesn't seem to work for me.
Any advice would be greatly appreciated.


/**
 * Change woocommerce_ajax_variation_threshold
 */
function custom_wc_ajax_variation_threshold( $qty, $product ) {
	return 200;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 100, 2 );

I have the same problem.
Can anyone help us?

@claudiosanches

This comment has been minimized.

Copy link
Owner Author

commented Jul 8, 2019

This code works just fine in WooCommerce 3.6.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.