26 Jan 2019

How to handle multiple variations in WooCommerce

WooCommerce is the most popular and the most used e-commerce platform in the world.

It is the most versatile and customizable store platform available, letting you create many types of products to meet any type of business need. It does so many things right with so little flaws.

Handling multiple variations is one of its flaws and probably you may have asked yourself:


Why having over 35 product variations slows down my WooCommerce?

Image taken from workinsports.com

When a product has a round 35 or less variations, WooCommerce includes all the variation data during the page load (when the product page loads), and the process that identifies a variation is done via Javascript in the client’s browser. When the product has more than 35 products, WooCommerce calls the server, in the background via Ajax calls, to query and identify a variation based the selected product attributes; this process slows down the more variations the product has.

To understand why, first you need to acknowledge that WooCommerce is mounted on WordPress and that WordPress, by it self, is a platform that is holding not only your store content, but your posts, users and other data from your website.

All this information is stored in WordPress’ database in form of data tables and mostly all of these hold records from multiple types of data. To give you an example, your products, posts and pages are stored in the same data table.

Your product attributes, which are what WooCommerce uses to create variations, are stored in the same data table where every category, tags and similar data are stored.

The way the database is structured and the way the data is stored are what make WooCommerce to slow down, because it needs to create mega queries to find a variation match in the database. The more variations you add the more it slows down.

Developer hint: More specifically you will notice that the request wc-ajax.php?action=get_variation is not responding in optimal times.


How to fix WooCommerce variations with high and slow response times?

Image taken from keenyakelly.com

What you need is to implement different techniques to the way WooCommerce is handling this query.

Thankfully for you, we have already done this and we have released a paid plugin that optimizes and fixes this issue.

WooCommerce Variations Optimizer
WooCommerce Variations Optimizer

WooCommerce Variations Optimizer reduces this WooCommerce response time to an average 700ms (on dedicated servers) and 1.2 seconds (on shared servers); these times are maintained even on products with over 500 variations (which is insane!).


Conclusion

Hope I was able to explain to you why your WooCommerce is behaving the way it is and how to solve it. If you have any questions or suggestions on the matter don’t doubt to comment below.