Last active
September 24, 2024 17:55
-
-
Save claudiosanches/6f91ad228c2176b986b2 to your computer and use it in GitHub Desktop.
WooCommerce - Change ajax variation threshold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_wc_ajax_variation_threshold( $qty, $product ) { | |
return 10; | |
} | |
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 ); |
Product page is not loading after making changes to the product variation
The product page is not saving after i make changes to the product variation. I have more than 100 variations
I have attached a video. The cache has been cleared and the issue is still the same.
http://www.colourwarehouse.com/wp-content/uploads/2023/05/www_screencapture_com_2023-5-1_08_44.mp4
It worked correctly for 100 variations.
To be cautious and not to touch the "functions.php" file, I inserted this code through the WP Code plugin.
Thank you very much!
Yep, it works flawlessly for me too. Thanks.
WP 6.6 WC 9.1.2
Thank-you for this. I was wondering why Add To Cart wasn't showing up on a product with 50 variations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Claudio,
Thank you for sharing this useful snippet - way better than the standard approach.
Do you know if there is a way to have Amazon's behavior instead?
So instead of showing "Sorry, no products matched your selection. Please choose a different combination.", to have the option to see the available options:

Here's the listing I am referring to:
https://www.amazon.com/OULUOQI-Stainless-Magnetic-Replacement-iWatch/dp/B099JF5S9Z/
Thank you!
Regards,
John