Develop WooCommerce

The official WooCommerce development blog

Theme and Plugin Developer Handbooks — March 9, 2018

Theme and Plugin Developer Handbooks

All of the important information you need when developing plugins and themes for WooCommerce has been summarized, compiled, and aggregated it into two helpful guides: the WooCommerce Theme Developer Handbook and the WooCommerce Plugin Developer Handbook.

These handbooks contain overviews, examples, best practices, and links to other relevant documents. They are an excellent way for people beginning WooCommerce development to get up-to-speed as well as a useful reference for experienced developers.

You can check them out here:

We recommend bookmarking them so you have a handy place to go any time you run into a question while developing WooCommerce-compatible plugins and themes.

If you notice any important topic or links to documentation you reference regularly missing from these handbooks please leave a comment below so we can make these as useful as possible for everyone.

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.