10up Open Sources ElasticPress Plugin for WooCommerce

WooCommerce is currently the most popular way to add a store to WordPress. Its usage is on the rise and seems to be growing in tandem with global WordPress usage. Wappalyzer estimates a 31% marketshare in the e-commerce category and BuiltWith has WooCommerce at roughly 29% among other shopping cart technologies. Either way you slice it, WooCommerce accounts for a big piece of the pie.

Store managers are attracted to WooCommerce because of its ease of use and its ecosystem that offers hundreds of free and commercial extensions. The reason many stores are still built on Magento, an open source shopping cart with a more complicated store management interface, is because it was built to handle massive stores with thousands of products and complex searches. WooCommerce is rapidly becoming a more viable option for these types of stores, with continual performance improvements and the new open source ElasticPress WooCommerce extension from 10up.

In 2014 the engineering team at 10up created ElasticPress to improve WordPress search, allow for complex search filters, and allow for cross-blog search within multisite (a feature missing from existing ElasticSearch plugins at the time).

Taylor Lovett, 10up’s Director of Web Engineering, said he was surprised by the amount of feedback they received on the project.

“The plugin grew from just search to improving WordPress performance by routing slow queries through Elasticsearch,” Lovett said. “As such, we continued to iterate on the project, supporting as many WP_Query parameters as possible and making things as developer friendly as possible.”

During that time Lovett was traveling to WordCamps around the world talking about the power of ElasticPress. He met other developers who asked what it would take to support WooCommerce queries.

“ElasticPress has a very powerful API that allows it to route almost all WordPress functionality through Elasticsearch instead of MySQL,” Lovett said. “However, in order to make the plugin really work for WooCommerce, we needed a ‘connector’ of sorts. The connector mostly enables Elasticsearch integration in the admin, adds support for indexing ALL post statuses and public post types, and passes appropriate GET parameters to WP_Query in ElasticPress proper formats. ElasticPress tries to support all of WP_Query functionality but there are some holes that the connector needed to fill.

“I knew that WooCommerce sites could suffer from performance problems given the complex product/order queries that they run,” he said. “As such, we built ElasticPress WooCommerce to solve those problems.”

After testing the plugin locally on a store with about 10,000 products and 20,000 orders, 10up found that “ElasticPress WooCommerce can easily turn database queries that take 3-4 seconds into Elasticsearch queries that take 30 milliseconds.” According to Lovett, the tests included about 20 WooCommerce extensions and the database queries were timed using the Debug Bar, Debug Bar Extender, and Debug Bar ElasticPress.

ElasticPress WooCommerce provides roughly a 100% data retrieval performance improvement when it comes to filtering products on both the frontend and in the admin. This helps stores render pages faster to capture potential customers while they’re in the buying mood.

Using ElasticPress WooCommerce for Performance Increases with Other Extensions

ElasticPress WooCommerce requires ElasticPress 1.8+ and PHP 5.2.4+. Once those are in place, it is relatively plug-and-play. Lovett said that the only caveat is that it is not guaranteed to support the hundreds of WooCommerce extensions completely. If an extension uses WP_Query in a way that’s compatible with ElasticPress then it should automatically take advantage of the performance increases.

“We try to support as much extension functionality as we can but there is just too much to tackle,” he said. “The way those extensions use WP_Query varies. We can’t predict how every extension interacts with WP_Query and don’t have time to test every single one.

“Some extensions have no bearing on ElasticPress WooCommerce,” Lovett said. “For example, a different payment gateway. Extensions that involve showing/filtering products and orders should test their extensions with the plugin and refer to the ElasticPress documentation to make sure they are only using supported WP_Query parameters.”

10up is looking for more developers to test and collaborate on the project, which is hosted on both GitHub and WordPress.org. The company plans to improve the plugin based on experience with enterprise WooCommerce customers. If you are looking to scale WooCommerce or are currently managing a sluggish store, ElasticPress WooCommerce is one option that you may want to test.