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.

WooCommerce 3.3 RC1 — January 11, 2018
January 16th: Dev chat #17 — January 9, 2018

January 16th: Dev chat #17

The next chat will be on January 16th at 17:00 UTC in the #core channel of the WooCommerce Community Slack. If you don’t already have access to the group, you can request an invite at the bottom of the WooCommerce developers page.

Here is the agenda for the chat:

If you have anything to propose for the agenda or related to the above, please leave a comment below.

See you there!

WooCommerce 3.3 beta 2 — January 5, 2018

WooCommerce 3.3 beta 2

WooCommerce 3.3 beta 2 is now available. This beta release has a whole host of bug fixes and is ready for testing! To test WC 3.3 beta 2 you can use our beta tester plugin or download the release here.

Thanks for testing WooCommerce, and if you find any bugs please open an issue!

WooCommerce 3.2.6 fix release notes — December 13, 2017

WooCommerce 3.2.6 fix release notes

WooCommerce 3.2.6 is now available. This fixes various minor issues, and includes some more improvements to cart rounding.

~50 commits made it into this release. The full changelog is below.

* Fix - CSV Importer - Fix ID mapping to existing IDs.
* Fix - CSV Importer - Unslash header fields to avoid extra slashes.
* Fix - CSV Importer - Allow import and export of draft products.
* Fix - CSV Importer - Get global attribute ID only when is a global attribute.
* Fix - Remove URL fragment when appending geolocation hash.
* Fix - Additional cart rounding fixes so rounding before subtotal works again. Added more unit tests.
* Fix - Add BOM to exported report CSVs.
* Fix - is_visible should ensure product is is not trashed before returning true.
* Fix - Return packages with no rates back to the cart so the shipping calculator is displayed even when the current country is not shippable.
* Fix - Merge session and persistent carts when both exists after login.
* Fix - Remove "wc_error" query string after login. 
* Fix - Allow woocommerce_form_field() have 'custom_attributes' equal 0.
* Fix - Bulk actions in status logs table.
* Fix - Exclude add-to-cart from pagination links.
* Fix - Updated $GLOBALS['post'] data in products shortcode to prevent theme conflicts.
* Fix - Only remove base taxes in cart totals class if item is taxable.
* Fix - REST API - Fixed date format in reports schema.
* Fix - REST API - Updated product categories image schema.
* Fix - REST API - UUse KSES for purchase_note like in admin.
* Fix - REST API - Filter passed images before processing so they can be unset via querystring.
* Tweak - Use protected instead of private methods to allow easy override in session handler.
* Tweak - wc_lostpassword_url should not be used before init - added warning.
* Localization - Update Japanese prefectures to include prefecture type.

Download the latest release of WooCommerce here or venture over to Dashboard → Updates to update your plugins from WordPress.

As usual, if you spot any other issues in WooCommerce core please log them in detail on Github, and to disclose a security issue to our team, please submit a report via HackerOne here. Comments on this post are closed.