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

Performance Optimization for Products with High Variation Counts

Théo Jeanney

Dear Variation Swatches For WooCommerce Support Team,

I hope this message finds you well. I am reaching out to seek assistance with a performance issue I am currently experiencing on my WooCommerce site, which utilizes your Variation Swatches plugin. We have been impressed with the functionality and user experience your plugin offers; however, we’ve encountered a significant challenge with one of our products that has approximately 1300 variations.

The issue at hand is the considerable load time when accessing this product page. The lengthy delay significantly impacts the user experience, potentially affecting our sales and customer satisfaction. Given the importance of this product in our catalog, finding a solution to optimize the loading time is of utmost urgency.

Could you please provide guidance on how to optimize the performance for products with a high number of variations? If there are any best practices, alternative approaches, or updates in the pipeline that could assist in this matter, I would be eager to implement them.

Thank you for your time and support. I look forward to your prompt response and am hopeful for a resolution that will allow us to continue providing a seamless shopping experience for our customers.

Best Regards,

Theo

 

Théo Jeanney

I am writing to follow up on my previous message sent a few days ago regarding a significant performance issue we are encountering with a product that has approximately 1300 variations on our WooCommerce site. This issue, related to the extensive load times of the product page, critically impacts our user experience and could potentially affect our sales and customer satisfaction.

Could you please let us know if you have had the chance to review our situation and if there are any suggestions, updates, or best practices you recommend for optimizing loading times for products with a significant number of variations? Any guidance or assistance you can provide would be greatly appreciated.

We understand the demands on your support team but given the urgency of this matter for our business, we would be grateful for a prompt response.

Thank you once again for your time and support.

Best Regards,

Théo

Hakik Zaman

Hi Théo,

Thanks for reaching out to us. Please make sure you have Redis Object Cache support on your server.

Simply contact your hosting support and ask for the Redis Object Cache. If they have this feature, ask them to enable it for your site.

Then use this plugin: https://wordpress.org/plugins/redis-cache/

I hope this will improve the speed.

Thank You

Théo Jeanney

Hi Hakik,

Following your advice, I have confirmed that Redis Object Cache support is enabled on our server, and I have successfully installed and activated the Redis Cache plugin available at https://wordpress.org/plugins/redis-cache/. However, after implementing this solution and thoroughly testing our site, I regret to inform you that we have not observed the anticipated improvement in the loading time for the product page in question.

The page load time remains significantly high, which continues to impact our user experience adversely. This situation leads me to believe there might be other underlying issues or additional steps we need to consider optimizing our site’s performance effectively, particularly for products with a large number of variations.

Could you please provide further assistance or recommend any other strategies, configurations, or optimizations that could help mitigate this issue?

Thank you for your continued support. I look forward to hearing from you soon.

Best Regards,

Théo

Hakik Zaman

Hi Théo,

Please try the following snippet using a plugin called Code Snippets or inside the child theme’s functions.php:

add_filter( 'woocommerce_ajax_variation_threshold', 'woo_variation_swatches_global_ajax_variation_threshold_min', 10, 2 );
function woo_variation_swatches_global_ajax_variation_threshold_min( $size, $product ){
return 1300;
}

Note: It is recommended to add the Custom Code to the child theme’s functions.php file, to avoid any data loss while updating the Parent Theme.

Thank You

Théo Jeanney

Hi Hakik,

Following your recommendation, I implemented the provided code using the Code Snippets plugin, ensuring a more streamlined approach to managing customizations. I am pleased to report that this adjustment has effectively resolved the initial challenge we faced with variations not loading efficiently. Upon visiting the product page, all variations are now pre-loaded as intended, which is a significant improvement.

However, it has introduced a new challenge regarding the overall page load time. We’ve noticed that the time it takes for the entire page to become responsive has increased, likely due to the pre-loading of a large number of variations. This longer load time could potentially impact the user experience, possibly affecting visitor engagement and conversion rates.

Thank you once again for your support and dedication to helping us resolve these technical challenges. I look forward to any recommendations you might have.

Best Regards,

Théo

Hakik Zaman

Hi Théo,

Do you have only one product with 1300 variations?

If so can you please share the product id?

You can also try the above snippet like the following:

add_filter( 'woocommerce_ajax_variation_threshold', 'woo_variation_swatches_global_ajax_variation_threshold_min', 10, 2 );
function woo_variation_swatches_global_ajax_variation_threshold_min( $size, $product ){
   if( is_single( absint( product id ) ) ){
      return 1300;
   }
}

Thank You

Théo Jeanney

Hi Hakik,

I will implement the customized snippet as suggested, targeting the specific product ID to optimize its performance. This solution seems to be a viable short-term fix, and I’m hopeful it will improve the user experience for this particular product.

Looking ahead, I’m concerned about scalability and maintaining optimal site performance as we introduce more high-variation products. In this context, I was wondering if there are any server-level cache solutions or strategies you might recommend that could help manage the increased load more efficiently. I’m open to exploring any options that could provide a more sustainable and automated approach to handling products with a large number of variations, minimizing the need for product-specific customizations.

Thank you once again for your support and for considering my request.

Best Regards,

Théo

Hakik Zaman

Hi Théo,

Here is the recommendation List (by the Development team) for the speed issue

Nginx CacheRedis
Object Cache
WP Rocket
Cloudflare
MariaDB
Nginx Server
PHP 7.3+
VPS

Thank You

Théo Jeanney

Hi Hakik,

Thank you very much,

I’m keeping this recommendation,

Have a great day,

Théo

Hakik Zaman

Hi Théo,

We have applied the above recommendations on our demo site here: https://demo.getwooplugins.com/woocommerce-variation-swatches/product-details/

I hope the above list will help you to speed up your site.

We get excited & honored when you use our plugin on your site.

If you found my support helpful, could you please leave your valuable review here: https://wordpress.org/support/plugin/woo-variation-swatches/reviews/?filter=5

Your rating keeps us inspired.

Thank You

Théo Jeanney

Hi Hakik,

Thank you very much for your answer,

Yes of course I’m gonna leave a review, your help was perfect.

I have just another issue with one of my products that have ~2000 variations : https://abianpaysbasque.fr/produit/ski-de-protection-blindage-rival/?wpo_single_page_cache_purged=1

In my function.php I have this code :

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 2500;
}

But it does not work for this product, do you have an idea ?

Have a great day,

Théo

Hakik Zaman

Hi Théo,

I think, for the huge number of variations you should disable the Swatches plugin.

You can add the following snippet to disable swatches for specific products:

add_filter('default_woo_variation_swatches_single_product_dropdown_html', function($default){
global $product;
$target = [14]; //Insert the product id’s inside the target. For example: [14,45]
if( in_array( $product->get_id(), $target ) ){
return true;
}
return $default;
}, 10, 1);

Thank You

Théo Jeanney

Hi Hakik,

Thank you for your help,

I did what you asked me to do, but on the product in question I have the impression that the Swatches plugin is still active.

https://abianpaysbasque.fr/produit/ski-de-protection-blindage-rival/

 

This is my snippet code :

add_filter(‘default_woo_variation_swatches_single_product_dropdown_html’, function($default){
global $product;
$target = [29365]; //Insert the product id’s inside the target. For example: [14,45]
if( in_array( $product->get_id(), $target ) ){
return true;
}
return $default;
}, 10, 1);

But I’d like to be able to stop it for this product because the time is too high unfortunately…
Do you have a solution to my problem?
Thank you in advance,
Best regards,
Théo

Théo Jeanney

Hi Hakik,

Oh right, my mistake!
The product still takes a long time to load, given the many variations… do you perhaps have a solution so that I can speed up the process? I can’t figure out how to make it work!

Thank you in advance,
Best Regards,
Théo

Hakik Zaman

Hi Théo,

do you perhaps have a solution so that I can speed up the process?

That product is using the default WooCommerce dropdown and it is still taking time to load.

Unfortunately, there is no more workaround for this (from my side). 🙁

I hope you will understand.

Thank You

Théo Jeanney

Hi Hakik,
I understand completely, thank you very much for your help and responsiveness!

Best Regards,

Théo