Develop WooCommerce

The official WooCommerce development blog

Performance: Switching to post_author to store order customer IDs — January 15, 2018

Performance: Switching to post_author to store order customer IDs

WooCommerce core uses a post meta called _customer_user to store the customer ID for orders. Since the meta_value field of the wp_postmeta table is not indexed, this means that all the queries that need to filter orders by customer ID are very slow.

To address this, in PR #17895, we are exploring the idea of using post_author, instead of a post meta, to store the customer ID. _ customer_user will still be populated to preserve backward compatibility.

This change will significantly improve the performance of queries that need to filter orders by customer ID.

On a test database with about 2.5 million entries in the wp_posts table and about 100 million entries in the wp_postmeta table running on a local dev machine, the query used by WC core to filter orders by customers in admin dropped from 25 seconds when using _customer_user to 0.0008 seconds when using post_author. Those numbers were retrieved using the plugin query-monitor and the two different queries can be seen in the screenshots below.

Query using _customer_user:

Screenshot from 2018-01-10 16-01-42

Query using post_author:

Screenshot from 2018-01-10 15-53-57

Although WC core doesn’t use the post_author field for orders, before merging this change, we want to make sure that it won’t break any existing extensions that could be using post_author for something else. Hence this post to share our plan with the community and ask for feedback.

Please let us know of any concerns you might have in the comments below or directly in the PR. If there are no objections, we plan to ship this change in WooCommerce 3.4.

Dev Chat Summary – June 20th — June 27, 2017

Dev Chat Summary – June 20th

This post summarizes the dev chat meeting from June 20th (agenda, Slack archive).

Questions and feedback related to WooCommerce 3.1 RC

How will the CSV importer work with classes that extend product, e.g. Bookings? will it work out of the box or adjustment will be needed? bor0

By default support any type of product type, and it’s able to handle all meta data, so for most of the 3rd party plugins should work just fine. There’s still a guide about extending the importer/exporter.

One piece of feedback RE exporting products: any thoughts on adding export by category? seems like it may be better for bulk updates than product type bekarice

If it’s something needed we should be happy to include in 3.1. It’s also possible to support this idea on WooCommerce Ideas Board.

So it looks like the export / import isn’t using the asynch processing? bekarice

All import/export processing is done in batching with AJAX, so as long as the windows is open, it will happily import/export all day.

Is WC core a place we can explore a better background processing than cron? pmgarman

For now import/export does not need it, but this is something that we definitely want to look in the future to improve other use cases, like the mailer.

I’ve a question. Has anyone had to do compatibility updates for 3.1, if so, why and was it core at fault? mikejolley

Most of people just had a little work with deprecation notices, e.g with WC_Order_Item_Meta class, but in general no fatal errors or problems like we had in the past.

Welcome to selectWoo

selectWoo is our fork of select2 JavaScript library, where we fixed several accessibility issues and changed the namespace for WooCommerce usage, this should handle incompatibilities caused by different select2 versions too.

Dev Chat Summary – June 6th — June 7, 2017

Dev Chat Summary – June 6th

This post summarizes the dev chat meeting from June 6th (agenda, Slack archive).

WooCommerce 3.1 Beta

  • Beta 2 should be available soon.
  • Still on track for a release at the end of June.
  • Please test the new importer/exporter included in WooCommerce.

Rest API feature plugin

  • API development will now be done in a separate repo.
  • When new API versions are ready they will be merged into WooCommerce and released with the next WooCommerce version.
  • This will enable API development to not be tied to the WooCommerce release schedule.
  • The legacy v1, v2, and v3 APIs will be removed in WooCommerce 4.0.

Extensions version checking

  • Sites had a high amount of errors when people upgraded to WooCommerce 3.0 and were using extensions that were not ready for WooCommerce 3.0.
  • We need to show warnings or programmatically manage extensions that are not compatible with new versions of WooCommerce somehow.
  • An issue has been created on GitHub for this. Please leave feedback or ideas.
Dev Chat Summary: April 25th — April 27, 2017

Dev Chat Summary: April 25th

This post summarizes the dev chat meeting from April 25th. (agenda, Slack archive).

Product Admin UI

  • Mock-up of proposed redesign.
  • The UI changes are primarily to reduce confusion with new users.
  • Product data panel remains the same.
  • Primary concerns are about existing plugins that add fields still being compatible with the redesign, especially the price fields area.
  • Auto-generating SKUs will be tricky to get right.

CRUD Search Helpers

  • Standardized way for developers to get information out of the database without having to worry about the actual database structure.
  • Information will be retrieved using WC_Object_Query objects similar to WP_Query.
  • This is under development now. See this pull request for an initial implementation.
  • WC_Object_Query objects support querying by props and a subset of the parameters WP_Query supports.
  • 3.1 will have Order and Product queries.

Importer / Exporter

  • Please provide feedback on the proposed schema.
  • Fields that don’t match a known field get imported as meta data.
  • Handling of serialized data is a concern.
  • We need to work out a good solution for a long-running import. One option is a background process with periodic polling to get the status.
Say hello to WooCommerce 3.0 “Bionic Butterfly” — April 4, 2017

Say hello to WooCommerce 3.0 “Bionic Butterfly”

Today we’re excited to release WooCommerce 3.0 (previously 2.7), dubbed the “Bionic Butterfly”, into the wild! 3.0 has been in beta since December, development since August, and has had over 3000 commits from 115 contributors.

Read on to find out what’s new!

bionic-butterfly

3.0 is a major update. As always, please ensure extensions and themes are compatible before upgrading, test on a staging site if you can, and make a backup for peace of mind.

Continue reading