Nasim
Nasim

Reputation: 125

My woocommerce product page too slow after adding many variations

I am using Woocommerce for my online store. I Have added a product with around 300 variations but its very slow when I am trying to switch attributes. But when I am trying to add only around 10 variations its good. how I can solve this please help. My Site link https://www.coversfeed.com/product/cute-bear-blue-phone-case/

Upvotes: 1

Views: 3329

Answers (1)

dineshkashera
dineshkashera

Reputation: 1502

There is no need to install plugins for bit of code. You can also resolved your issues by adding filter hook woocommerce_ajax_variation_threshold.

Please add the below code in your current active theme in functions.php file.

/**
 * Fix for issue where too many variations causes the front end to not pre-load
 * all variations and rely on AJAX.
 */
function custom_wc_ajax_variation_threshold_resolved( $qty, $product )
{
    return 100;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold_resolved', 10, 2 );

Upvotes: 2

Related Questions